mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#196 Formatting
This commit is contained in:
parent
529acf6055
commit
720bcd83c5
@ -34,6 +34,7 @@ import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.type.TypeMirror;
|
||||
import javax.lang.model.util.Elements;
|
||||
import javax.lang.model.util.Types;
|
||||
|
||||
import org.mapstruct.ap.util.Executables;
|
||||
import org.mapstruct.ap.util.Filters;
|
||||
import org.mapstruct.ap.util.TypeUtilsJDK6Fix;
|
||||
@ -76,13 +77,10 @@ public class Type extends ModelElement implements Comparable<Type> {
|
||||
private List<ExecutableElement> alternativeTargetAccessors = null;
|
||||
|
||||
//CHECKSTYLE:OFF
|
||||
public Type(Types typeUtils, Elements elementUtils,
|
||||
TypeMirror typeMirror, TypeElement typeElement, List<Type> typeParameters,
|
||||
Type implementationType,
|
||||
String packageName, String name, String qualifiedName,
|
||||
boolean isInterface,
|
||||
boolean isEnumType, boolean isIterableType, boolean isCollectionType, boolean isMapType,
|
||||
boolean isImported) {
|
||||
public Type(Types typeUtils, Elements elementUtils, TypeMirror typeMirror, TypeElement typeElement,
|
||||
List<Type> typeParameters, Type implementationType, String packageName, String name,
|
||||
String qualifiedName, boolean isInterface, boolean isEnumType, boolean isIterableType,
|
||||
boolean isCollectionType, boolean isMapType, boolean isImported) {
|
||||
|
||||
this.typeUtils = typeUtils;
|
||||
this.elementUtils = elementUtils;
|
||||
@ -265,7 +263,7 @@ public class Type extends ModelElement implements Comparable<Type> {
|
||||
* @return an unmodifiable list of all getters (including 'is' for booleans).
|
||||
*/
|
||||
public List<ExecutableElement> getGetters() {
|
||||
if (getters == null) {
|
||||
if ( getters == null ) {
|
||||
List<? extends Element> members = elementUtils.getAllMembers( typeElement );
|
||||
getters = Collections.unmodifiableList( Filters.getterMethodsIn( members ) );
|
||||
}
|
||||
@ -278,7 +276,7 @@ public class Type extends ModelElement implements Comparable<Type> {
|
||||
* @return an unmodifiable list of all setters
|
||||
*/
|
||||
public List<ExecutableElement> getSetters() {
|
||||
if (setters == null) {
|
||||
if ( setters == null ) {
|
||||
List<? extends Element> members = elementUtils.getAllMembers( typeElement );
|
||||
setters = Collections.unmodifiableList( Filters.setterMethodsIn( members ) );
|
||||
}
|
||||
@ -325,13 +323,12 @@ public class Type extends ModelElement implements Comparable<Type> {
|
||||
return alternativeTargetAccessors;
|
||||
}
|
||||
|
||||
private boolean isCollection( TypeMirror candidate ) {
|
||||
private boolean isCollection(TypeMirror candidate) {
|
||||
String collectionName = Collection.class.getCanonicalName();
|
||||
TypeMirror collectionType = typeUtils.erasure( elementUtils.getTypeElement( collectionName ).asType() );
|
||||
return TypeUtilsJDK6Fix.isSubType( typeUtils, candidate, collectionType );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the length of the shortest path in the type hierarchy between this type and the specified other type.
|
||||
* Returns {@code -1} if this type is not assignable to the other type. Returns {@code 0} if this type is equal to
|
||||
|
@ -35,7 +35,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.ConcurrentNavigableMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
|
||||
import javax.lang.model.element.ElementKind;
|
||||
import javax.lang.model.element.ExecutableElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
@ -188,6 +187,7 @@ public class TypeFactory {
|
||||
* If type represents {@code int}, it will return the type that represents {@code Class<Integer>}.
|
||||
*
|
||||
* @param type the type to return the declared class type for
|
||||
*
|
||||
* @return the type representing {@code Class<type>}.
|
||||
*/
|
||||
public Type classTypeOf(Type type) {
|
||||
|
@ -193,7 +193,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
|
||||
}
|
||||
Type declaringMapper = mappingMethod.getDeclaringMapper();
|
||||
if ( implementationRequired ) {
|
||||
if ( ( declaringMapper == null ) || declaringMapper.equals( typeFactory.getType( element ) ) ) {
|
||||
if ( ( declaringMapper == null ) || declaringMapper.equals( typeFactory.getType( element ) ) ) {
|
||||
mappingMethods.add( new DelegatingMethod( mappingMethod ) );
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user