#81, refactoring MappingMethodReference to MethodReference to accomodate for factory usage of this method

This commit is contained in:
sjaakd 2014-02-02 16:49:35 +01:00
parent b456cc8b6b
commit a9d2f788de
6 changed files with 21 additions and 21 deletions

View File

@ -34,10 +34,10 @@ import org.mapstruct.ap.util.Strings;
*/
public class IterableMappingMethod extends MappingMethod {
private final MappingMethodReference elementMappingMethod;
private final MethodReference elementMappingMethod;
private final TypeConversion conversion;
public IterableMappingMethod(Method method, MappingMethodReference elementMappingMethod,
public IterableMappingMethod(Method method, MethodReference elementMappingMethod,
TypeConversion conversion) {
super( method );
this.elementMappingMethod = elementMappingMethod;
@ -54,7 +54,7 @@ public class IterableMappingMethod extends MappingMethod {
throw new IllegalStateException( "Method " + this + " has no source parameter." );
}
public MappingMethodReference getElementMappingMethod() {
public MethodReference getElementMappingMethod() {
return elementMappingMethod;
}

View File

@ -33,13 +33,13 @@ import org.mapstruct.ap.util.Strings;
*/
public class MapMappingMethod extends MappingMethod {
private final MappingMethodReference keyMappingMethod;
private final MappingMethodReference valueMappingMethod;
private final MethodReference keyMappingMethod;
private final MethodReference valueMappingMethod;
private final TypeConversion keyConversion;
private final TypeConversion valueConversion;
public MapMappingMethod(Method method, MappingMethodReference keyMappingMethod, TypeConversion keyConversion,
MappingMethodReference valueMappingMethod, TypeConversion valueConversion) {
public MapMappingMethod(Method method, MethodReference keyMappingMethod, TypeConversion keyConversion,
MethodReference valueMappingMethod, TypeConversion valueConversion) {
super( method );
this.keyMappingMethod = keyMappingMethod;
@ -58,7 +58,7 @@ public class MapMappingMethod extends MappingMethod {
throw new IllegalStateException( "Method " + this + " has no source parameter." );
}
public MappingMethodReference getKeyMappingMethod() {
public MethodReference getKeyMappingMethod() {
return keyMappingMethod;
}
@ -66,7 +66,7 @@ public class MapMappingMethod extends MappingMethod {
return keyConversion;
}
public MappingMethodReference getValueMappingMethod() {
public MethodReference getValueMappingMethod() {
return valueMappingMethod;
}

View File

@ -29,11 +29,11 @@ import org.mapstruct.ap.model.source.Method;
*
* @author Gunnar Morling
*/
public class MappingMethodReference extends MappingMethod {
public class MethodReference extends MappingMethod {
private final MapperReference declaringMapper;
public MappingMethodReference(Method method, MapperReference declaringMapper) {
public MethodReference(Method method, MapperReference declaringMapper) {
super( method );
this.declaringMapper = declaringMapper;
}

View File

@ -44,12 +44,12 @@ public class PropertyMapping extends ModelElement {
private final Type targetType;
private final boolean isTargetAccessorSetter;
private final MappingMethodReference mappingMethod;
private final MethodReference mappingMethod;
private final TypeConversion conversion;
public PropertyMapping(String sourceBeanName, String sourceName, String sourceAccessorName, Type sourceType,
String targetName, String targetAccessorName, Type targetType,
MappingMethodReference mappingMethod, TypeConversion conversion) {
MethodReference mappingMethod, TypeConversion conversion) {
this.sourceBeanName = sourceBeanName;
this.sourceName = sourceName;
@ -93,7 +93,7 @@ public class PropertyMapping extends ModelElement {
return targetType;
}
public MappingMethodReference getMappingMethod() {
public MethodReference getMappingMethod() {
return mappingMethod;
}

View File

@ -51,7 +51,7 @@ import org.mapstruct.ap.model.MapMappingMethod;
import org.mapstruct.ap.model.Mapper;
import org.mapstruct.ap.model.MapperReference;
import org.mapstruct.ap.model.MappingMethod;
import org.mapstruct.ap.model.MappingMethodReference;
import org.mapstruct.ap.model.MethodReference;
import org.mapstruct.ap.model.PropertyMapping;
import org.mapstruct.ap.model.TypeConversion;
import org.mapstruct.ap.model.common.Parameter;
@ -545,7 +545,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Metho
targetType = typeFactory.getReturnType( targetAcessor );
}
MappingMethodReference propertyMappingMethod = getMappingMethodReference(
MethodReference propertyMappingMethod = getMappingMethodReference(
mapperReferences,
methods,
sourceType,
@ -593,7 +593,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Metho
)
);
MappingMethodReference elementMappingMethod =
MethodReference elementMappingMethod =
getMappingMethodReference( mapperReferences, methods, sourceElementType, targetElementType );
if ( !sourceElementType.isAssignableTo( targetElementType ) && conversion == null &&
@ -637,13 +637,13 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Metho
"entry.getValue()"
);
MappingMethodReference keyMappingMethod = getMappingMethodReference(
MethodReference keyMappingMethod = getMappingMethodReference(
mapperReferences,
methods,
sourceKeyType,
targetKeyType
);
MappingMethodReference valueMappingMethod = getMappingMethodReference(
MethodReference valueMappingMethod = getMappingMethodReference(
mapperReferences,
methods,
sourceValueType,
@ -691,7 +691,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Metho
);
}
private MappingMethodReference getMappingMethodReference(List<MapperReference> mapperReferences,
private MethodReference getMappingMethodReference(List<MapperReference> mapperReferences,
Iterable<Method> methods, Type parameterType,
Type returnType) {
List<Method> candidatesWithMathingTargetType = new ArrayList<Method>();
@ -751,7 +751,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Metho
}
}
return new MappingMethodReference( method, mapperReference );
return new MethodReference( method, mapperReference );
}
private int addToCandidateListIfMinimal(List<Method> candidatesWithBestMathingType, int bestMatchingTypeDistance,