
public class MethodReference extends ModelElement implements Assignment
new operator).Assignment.AssignmentTypeWritable.Context| Modifier | Constructor and Description |
|---|---|
protected |
MethodReference(Method method,
MapperReference declaringMapper,
Parameter providingParameter,
List<ParameterBinding> parameterBindings)
Creates a new reference to the given method.
|
| Modifier and Type | Method and Description |
|---|---|
String |
createUniqueVarName(String desiredName)
Creates an unique safe (local) variable name.
|
boolean |
equals(Object obj) |
static MethodReference |
forBuiltInMethod(BuiltInMethod method,
ConversionContext contextParam) |
static MethodReference |
forConstructorInvocation(Type type,
List<ParameterBinding> parameterBindings) |
static MethodReference |
forForgedMethod(Method method,
List<ParameterBinding> parameterBindings) |
static MethodReference |
forMapperReference(Method method,
MapperReference declaringMapper,
List<ParameterBinding> parameterBindings) |
static MethodReference |
forMethodCall(String methodName) |
static MethodReference |
forParameterProvidedMethod(Method method,
Parameter providingParameter,
List<ParameterBinding> parameterBindings) |
static MethodReference |
forStaticBuilder(String builderCreationMethod,
Type definingType) |
Assignment |
getAssignment() |
String |
getContextParam() |
MapperReference |
getDeclaringMapper() |
Type |
getDefiningType() |
Set<Type> |
getImportTypes()
Returns a set containing those
Types referenced by this model element for which an import statement needs
to be declared. |
String |
getMapperVariableName() |
String |
getName() |
List<ParameterBinding> |
getParameterBindings() |
Parameter |
getProvidingParameter() |
Type |
getReturnType() |
Type |
getSingleSourceParameterType() |
String |
getSourceLocalVarName()
|
String |
getSourceLoopVarName()
See
Assignment.getSourceLoopVarName() (java.lang.String) } |
String |
getSourceParameterName()
Returns the source parameter name, to which this assignment applies.
|
List<Parameter> |
getSourceParameters() |
String |
getSourcePresenceCheckerReference()
the source presence checker reference
|
String |
getSourceReference()
the source reference being a source-getter, a constant, nested method call, etc.
|
Type |
getSourceType()
the source type used in the matching process
|
List<Type> |
getThrownTypes()
returns all types exception types thrown by this assignment.
|
Assignment.AssignmentType |
getType()
Returns whether the type of assignment
|
int |
hashCode() |
Type |
inferTypeWhenEnum(Type type) |
boolean |
isCallingUpdateMethod() |
boolean |
isConstructor() |
boolean |
isSourceReferenceParameter() |
boolean |
isStatic() |
void |
setAssignment(Assignment assignment)
An assignment in itself can wrap another assignment.
|
void |
setSourceLocalVarName(String sourceLocalVarName)
Replaces the sourceReference at the call site in the assignment in the template with this sourceLocalVarName.
|
void |
setSourceLoopVarName(String sourceLoopVarName)
Replaces the sourceLocalVar or sourceReference at the call site in the assignment in the template with this
sourceLoopVarName.
|
String |
toString() |
getTemplateName, getTemplateNameForClass, writeprotected MethodReference(Method method, MapperReference declaringMapper, Parameter providingParameter, List<ParameterBinding> parameterBindings)
method - the target method of the referencedeclaringMapper - the method declaring the mapper; null if the current mapper itselfprovidingParameter - The parameter providing the mapper, or null if the method is defined by the
mapper itself or by declaringMapper.parameterBindings - the parameter bindings of this method referencepublic MapperReference getDeclaringMapper()
public Parameter getProvidingParameter()
public String getMapperVariableName()
public String getContextParam()
public Assignment getAssignment()
public String getName()
public void setAssignment(Assignment assignment)
AssignmentsetAssignment in interface Assignmentassignment - the assignment to setpublic String getSourceReference()
AssignmentgetSourceReference in interface Assignmentpublic String getSourcePresenceCheckerReference()
AssignmentgetSourcePresenceCheckerReference in interface Assignmentpublic Type getSourceType()
AssignmentgetSourceType in interface Assignmentpublic String createUniqueVarName(String desiredName)
AssignmentcreateUniqueVarName in interface AssignmentdesiredName - the desired namepublic String getSourceLocalVarName()
AssignmentgetSourceLocalVarName in interface Assignmentpublic void setSourceLocalVarName(String sourceLocalVarName)
AssignmentsetSourceLocalVarName in interface AssignmentsourceLocalVarName - source local variable namepublic String getSourceLoopVarName()
AssignmentAssignment.getSourceLoopVarName() (java.lang.String) }getSourceLoopVarName in interface Assignmentpublic void setSourceLoopVarName(String sourceLoopVarName)
AssignmentsetSourceLoopVarName in interface AssignmentsourceLoopVarName - loop variablepublic String getSourceParameterName()
AssignmentgetSourceParameterName in interface Assignmentpublic boolean isSourceReferenceParameter()
isSourceReferenceParameter in interface Assignmentpublic Type getSingleSourceParameterType()
@TargetType parameterpublic Type getDefiningType()
public Set<Type> getImportTypes()
ModelElementTypes referenced by this model element for which an import statement needs
to be declared.getImportTypes in interface AssignmentgetImportTypes in class ModelElementnull.public List<Type> getThrownTypes()
AssignmentgetThrownTypes in interface Assignmentpublic Assignment.AssignmentType getType()
AssignmentgetType in interface AssignmentAssignment.AssignmentTypepublic Type getReturnType()
public boolean isCallingUpdateMethod()
isCallingUpdateMethod in interface Assignmentpublic boolean isStatic()
public boolean isConstructor()
public List<ParameterBinding> getParameterBindings()
public static MethodReference forBuiltInMethod(BuiltInMethod method, ConversionContext contextParam)
public static MethodReference forForgedMethod(Method method, List<ParameterBinding> parameterBindings)
public static MethodReference forParameterProvidedMethod(Method method, Parameter providingParameter, List<ParameterBinding> parameterBindings)
public static MethodReference forMapperReference(Method method, MapperReference declaringMapper, List<ParameterBinding> parameterBindings)
public static MethodReference forStaticBuilder(String builderCreationMethod, Type definingType)
public static MethodReference forMethodCall(String methodName)
public static MethodReference forConstructorInvocation(Type type, List<ParameterBinding> parameterBindings)
Copyright © 2012-2021 MapStruct Authors; All rights reserved. Released under the Apache Software License 2.0.