mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#120 Renaming BasicMethod to Method
This commit is contained in:
parent
06b4220af8
commit
34484c6686
@ -27,7 +27,7 @@ import org.mapstruct.ap.model.common.Accessibility;
|
||||
import org.mapstruct.ap.model.common.ModelElement;
|
||||
import org.mapstruct.ap.model.common.Parameter;
|
||||
import org.mapstruct.ap.model.common.Type;
|
||||
import org.mapstruct.ap.model.source.BasicMethod;
|
||||
import org.mapstruct.ap.model.source.Method;
|
||||
import org.mapstruct.ap.util.Strings;
|
||||
|
||||
/**
|
||||
@ -43,7 +43,7 @@ public abstract class MappingMethod extends ModelElement {
|
||||
private final Parameter targetParameter;
|
||||
private final Accessibility accessibility;
|
||||
|
||||
protected MappingMethod(BasicMethod method) {
|
||||
protected MappingMethod(Method method) {
|
||||
this.name = method.getName();
|
||||
this.parameters = method.getParameters();
|
||||
this.returnType = method.getReturnType();
|
||||
|
@ -38,7 +38,7 @@ import org.mapstruct.ap.util.Strings;
|
||||
*
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public abstract class BuiltInMethod extends ModelElement implements BasicMethod {
|
||||
public abstract class BuiltInMethod extends ModelElement implements Method {
|
||||
|
||||
|
||||
/**
|
||||
@ -64,7 +64,7 @@ public abstract class BuiltInMethod extends ModelElement implements BasicMethod
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc} {@link BasicMethod}
|
||||
* {@inheritDoc} {@link Method}
|
||||
*
|
||||
* Default the targetType should be assignable to the returnType and the sourceType to the parameter,
|
||||
* excluding generic type variables. When the implementor sees a need for this, this method can be overridden.
|
||||
@ -79,7 +79,7 @@ public abstract class BuiltInMethod extends ModelElement implements BasicMethod
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc} {@link BasicMethod}
|
||||
* {@inheritDoc} {@link Method}
|
||||
*
|
||||
* @return all parameters are source parameters for build-in methods.
|
||||
*/
|
||||
@ -89,7 +89,7 @@ public abstract class BuiltInMethod extends ModelElement implements BasicMethod
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc} {@link BasicMethod}
|
||||
* {@inheritDoc} {@link Method}
|
||||
*
|
||||
* declaring mapper is always null, being the MapperImpl itself. This method should not be overridden by
|
||||
* implementors
|
||||
@ -101,7 +101,7 @@ public abstract class BuiltInMethod extends ModelElement implements BasicMethod
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc} {@link BasicMethod}
|
||||
* {@inheritDoc} {@link Method}
|
||||
*/
|
||||
@Override
|
||||
public List<Parameter> getParameters() {
|
||||
|
@ -31,7 +31,7 @@ import org.mapstruct.ap.model.common.Type;
|
||||
* There are 2 known implementors: {@link BuiltInMethod} and {@link Method}
|
||||
* @author Sjaak Derksen
|
||||
*/
|
||||
public interface BasicMethod {
|
||||
public interface Method {
|
||||
|
||||
/**
|
||||
* Checks whether the provided sourceType and provided targetType match with the parameter respectively
|
@ -42,7 +42,7 @@ import org.mapstruct.ap.util.Strings;
|
||||
*
|
||||
* @author Gunnar Morling
|
||||
*/
|
||||
public class SourceMethod implements BasicMethod {
|
||||
public class SourceMethod implements Method {
|
||||
|
||||
private final Type declaringMapper;
|
||||
private final ExecutableElement executable;
|
||||
@ -143,7 +143,7 @@ public class SourceMethod implements BasicMethod {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc} {@link BasicMethod}
|
||||
* {@inheritDoc} {@link Method}
|
||||
*/
|
||||
@Override
|
||||
public Type getDeclaringMapper() {
|
||||
@ -155,7 +155,7 @@ public class SourceMethod implements BasicMethod {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc} {@link BasicMethod}
|
||||
* {@inheritDoc} {@link Method}
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
@ -163,7 +163,7 @@ public class SourceMethod implements BasicMethod {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc} {@link BasicMethod}
|
||||
* {@inheritDoc} {@link Method}
|
||||
*/
|
||||
@Override
|
||||
public List<Parameter> getParameters() {
|
||||
@ -171,7 +171,7 @@ public class SourceMethod implements BasicMethod {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc} {@link BasicMethod}
|
||||
* {@inheritDoc} {@link Method}
|
||||
*/
|
||||
@Override
|
||||
public List<Parameter> getSourceParameters() {
|
||||
@ -201,7 +201,7 @@ public class SourceMethod implements BasicMethod {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc} {@link BasicMethod}
|
||||
* {@inheritDoc} {@link Method}
|
||||
*/
|
||||
@Override
|
||||
public Type getReturnType() {
|
||||
@ -247,7 +247,7 @@ public class SourceMethod implements BasicMethod {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc} {@link BasicMethod}
|
||||
* {@inheritDoc} {@link Method}
|
||||
*/
|
||||
@Override
|
||||
public Parameter getTargetParameter() {
|
||||
@ -322,7 +322,7 @@ public class SourceMethod implements BasicMethod {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc} {@link BasicMethod}
|
||||
* {@inheritDoc} {@link Method}
|
||||
*/
|
||||
@Override
|
||||
public boolean matches( Type sourceType, Type targetType ) {
|
||||
|
@ -56,7 +56,7 @@ import org.mapstruct.ap.model.TypeConversion;
|
||||
import org.mapstruct.ap.model.common.Parameter;
|
||||
import org.mapstruct.ap.model.common.Type;
|
||||
import org.mapstruct.ap.model.common.TypeFactory;
|
||||
import org.mapstruct.ap.model.source.BasicMethod;
|
||||
import org.mapstruct.ap.model.source.Method;
|
||||
import org.mapstruct.ap.model.source.Mapping;
|
||||
import org.mapstruct.ap.model.source.SourceMethod;
|
||||
import org.mapstruct.ap.option.Options;
|
||||
@ -760,7 +760,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
|
||||
|
||||
|
||||
|
||||
private <T extends BasicMethod> T getBestMatch(SourceMethod mappingMethod, String mappedElement,
|
||||
private <T extends Method> T getBestMatch(SourceMethod mappingMethod, String mappedElement,
|
||||
Iterable<T> methods, Type parameterType,
|
||||
Type returnType) {
|
||||
List<T> candidatesWithMathingTargetType = new ArrayList<T>();
|
||||
@ -814,7 +814,7 @@ public class MapperCreationProcessor implements ModelElementProcessor<List<Sourc
|
||||
}
|
||||
|
||||
|
||||
private <T extends BasicMethod> int addToCandidateListIfMinimal(List<T> candidatesWithBestMathingType,
|
||||
private <T extends Method> int addToCandidateListIfMinimal(List<T> candidatesWithBestMathingType,
|
||||
int bestMatchingTypeDistance, T method, int currentTypeDistance) {
|
||||
if ( currentTypeDistance == bestMatchingTypeDistance ) {
|
||||
candidatesWithBestMathingType.add( method );
|
||||
|
Loading…
x
Reference in New Issue
Block a user