public class MethodReference extends MappingMethod implements Assignment
new
operator).Assignment.AssignmentType
Writable.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 |
createLocalVarName(String desiredName)
Creates an unique safe (local) variable name.
|
boolean |
equals(Object obj) |
static MethodReference |
forBuiltInMethod(BuiltInMethod method,
ConversionContext contextParam) |
static MethodReference |
forForgedMethod(Method method,
List<ParameterBinding> parameterBindings) |
static MethodReference |
forMapperReference(Method method,
MapperReference declaringMapper,
List<ParameterBinding> parameterBindings) |
static MethodReference |
forParameterProvidedMethod(Method method,
Parameter providingParameter,
List<ParameterBinding> parameterBindings) |
Assignment |
getAssignment() |
String |
getContextParam() |
MapperReference |
getDeclaringMapper() |
Type |
getDefiningType() |
Set<Type> |
getImportTypes()
Returns a set containing those
Type s referenced by this model element for which an import statement needs
to be declared. |
String |
getMapperVariableName() |
List<ParameterBinding> |
getParameterBindings() |
Parameter |
getProvidingParameter() |
Type |
getSingleSourceParameterType() |
String |
getSourceLocalVarName()
|
String |
getSourceParameterName()
Returns the source parameter name, to which this assignment applies.
|
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() |
boolean |
isCallingUpdateMethod() |
boolean |
isSourceReferenceParameter() |
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.
|
getAccessibility, getAfterMappingReferences, getBeforeMappingReferencesWithMappingTarget, getBeforeMappingReferencesWithoutMappingTarget, getName, getParameterNames, getParameters, getResultName, getResultType, getReturnType, getSourceParameters, isExistingInstanceMapping, isStatic, toString
getTemplateName, getTemplateNameForClass, write
protected 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 void setAssignment(Assignment assignment)
Assignment
setAssignment
in interface Assignment
assignment
- the assignment to setpublic String getSourceReference()
Assignment
getSourceReference
in interface Assignment
public String getSourcePresenceCheckerReference()
Assignment
getSourcePresenceCheckerReference
in interface Assignment
public Type getSourceType()
Assignment
getSourceType
in interface Assignment
public String createLocalVarName(String desiredName)
Assignment
createLocalVarName
in interface Assignment
desiredName
- the desired namepublic String getSourceLocalVarName()
Assignment
getSourceLocalVarName
in interface Assignment
public void setSourceLocalVarName(String sourceLocalVarName)
Assignment
setSourceLocalVarName
in interface Assignment
sourceLocalVarName
- source local variable namepublic String getSourceParameterName()
Assignment
getSourceParameterName
in interface Assignment
public boolean isSourceReferenceParameter()
isSourceReferenceParameter
in interface Assignment
public Type getSingleSourceParameterType()
@TargetType
parameterpublic Type getDefiningType()
public Set<Type> getImportTypes()
ModelElement
Type
s referenced by this model element for which an import statement needs
to be declared.getImportTypes
in interface Assignment
getImportTypes
in class MappingMethod
null
.public List<Type> getThrownTypes()
Assignment
getThrownTypes
in interface Assignment
getThrownTypes
in class MappingMethod
public Assignment.AssignmentType getType()
Assignment
getType
in interface Assignment
Assignment.AssignmentType
public boolean isCallingUpdateMethod()
isCallingUpdateMethod
in interface Assignment
public List<ParameterBinding> getParameterBindings()
public int hashCode()
hashCode
in class MappingMethod
public boolean equals(Object obj)
equals
in class MappingMethod
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)
Copyright © 2012-2017 Gunnar Morling; All rights reserved. Released under the Apache Software License 2.0.