Interface Assignment
-
- All Known Implementing Classes:
AdderWrapper
,ArrayCopyWrapper
,AssignmentWrapper
,EnumConstantWrapper
,ExistingInstanceSetterWrapperForCollectionsAndMaps
,GetterWrapperForCollectionsAndMaps
,Java8FunctionWrapper
,LifecycleCallbackMethodReference
,LocalVarWrapper
,MethodReference
,NewInstanceSetterWrapperForCollectionsAndMaps
,ReturnWrapper
,SetterWrapper
,SetterWrapperForCollectionsAndMaps
,SetterWrapperForCollectionsAndMapsWithNullCheck
,SourceRHS
,StreamAdderWrapper
,TypeConversion
,UpdateWrapper
,WrapperForCollectionsAndMaps
public interface Assignment
Assignment represents all kind of manners a source can be assigned to a target.- Author:
- Sjaak Derksen
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Assignment.AssignmentType
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
createUniqueVarName(String desiredName)
Creates an unique safe (local) variable name.Set<Type>
getImportTypes()
returns all types required as import by the assignment statement.String
getSourceLocalVarName()
String
getSourceLoopVarName()
SeegetSourceLoopVarName()
(java.lang.String) }String
getSourceParameterName()
Returns the source parameter name, to which this assignment applies.PresenceCheck
getSourcePresenceCheckerReference()
the source presence checker referenceString
getSourceReference()
the source reference being a source-getter, a constant, nested method call, etc.Type
getSourceType()
the source type used in the matching processList<Type>
getThrownTypes()
returns all types exception types thrown by this assignment.Assignment.AssignmentType
getType()
Returns whether the type of assignmentboolean
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.void
setSourceLoopVarName(String sourceLoopVarName)
Replaces the sourceLocalVar or sourceReference at the call site in the assignment in the template with this sourceLoopVarName.
-
-
-
Method Detail
-
getImportTypes
Set<Type> getImportTypes()
returns all types required as import by the assignment statement.- Returns:
- imported types
-
getThrownTypes
List<Type> getThrownTypes()
returns all types exception types thrown by this assignment.- Returns:
- exceptions thrown
-
setAssignment
void setAssignment(Assignment assignment)
An assignment in itself can wrap another assignment. E.g.:- a MethodReference can wrap a TypeConversion, another MethodReference and ultimately a Simple
- a TypeConversion can wrap a MethodReference, and ultimately a Simple
- Parameters:
assignment
- the assignment to set
-
getSourceReference
String getSourceReference()
the source reference being a source-getter, a constant, nested method call, etc.- Returns:
- source reference
-
isSourceReferenceParameter
boolean isSourceReferenceParameter()
- Returns:
- true when the source reference is the source parameter (and not a property of the source parameter type)
-
getSourcePresenceCheckerReference
PresenceCheck getSourcePresenceCheckerReference()
the source presence checker reference- Returns:
- source reference
-
getSourceType
Type getSourceType()
the source type used in the matching process- Returns:
- source type (can be null)
-
createUniqueVarName
String createUniqueVarName(String desiredName)
Creates an unique safe (local) variable name.- Parameters:
desiredName
- the desired name- Returns:
- the desired name, made unique in the scope of the bean mapping.
-
getSourceLocalVarName
String getSourceLocalVarName()
- Returns:
- local variable name (can be null if not set)
-
getSourceParameterName
String getSourceParameterName()
Returns the source parameter name, to which this assignment applies. Note: the source parameter itself might be mapped by this assignment, or one of its properties- Returns:
- the source parameter name
-
setSourceLocalVarName
void setSourceLocalVarName(String sourceLocalVarName)
Replaces the sourceReference at the call site in the assignment in the template with this sourceLocalVarName. The sourceLocalVarName can subsequently be used for e.g. null checking.- Parameters:
sourceLocalVarName
- source local variable name
-
getSourceLoopVarName
String getSourceLoopVarName()
SeegetSourceLoopVarName()
(java.lang.String) }- Returns:
- loop variable (can be null if not set)
-
setSourceLoopVarName
void setSourceLoopVarName(String sourceLoopVarName)
Replaces the sourceLocalVar or sourceReference at the call site in the assignment in the template with this sourceLoopVarName. The sourceLocalVar can subsequently be used for e.g. null checking.- Parameters:
sourceLoopVarName
- loop variable
-
getType
Assignment.AssignmentType getType()
Returns whether the type of assignment- Returns:
Assignment.AssignmentType
-
isCallingUpdateMethod
boolean isCallingUpdateMethod()
-
-