Class SourceRHS

All Implemented Interfaces:
Assignment, Writable

public class SourceRHS extends ModelElement implements Assignment
SourceRHS Assignment. Right Hand Side (RHS), source part of the assignment. This class contains all information on the source side of an assignment needed for common use in the mapping.
Author:
Sjaak Derksen
  • Constructor Details

    • SourceRHS

      public SourceRHS(String sourceReference, Type sourceType, Set<String> existingVariableNames, String sourceErrorMessagePart)
    • SourceRHS

      public SourceRHS(String sourceParameterName, String sourceReference, PresenceCheck sourcePresenceCheckerReference, Type sourceType, Set<String> existingVariableNames, String sourceErrorMessagePart)
  • Method Details

    • getSourceReference

      public String getSourceReference()
      Description copied from interface: Assignment
      the source reference being a source-getter, a constant, nested method call, etc.
      Specified by:
      getSourceReference in interface Assignment
      Returns:
      source reference
    • isSourceReferenceParameter

      public boolean isSourceReferenceParameter()
      Specified by:
      isSourceReferenceParameter in interface Assignment
      Returns:
      true when the source reference is the source parameter (and not a property of the source parameter type)
    • getSourcePresenceCheckerReference

      public PresenceCheck getSourcePresenceCheckerReference()
      Description copied from interface: Assignment
      the source presence checker reference
      Specified by:
      getSourcePresenceCheckerReference in interface Assignment
      Returns:
      source reference
    • setSourcePresenceCheckerReference

      public void setSourcePresenceCheckerReference(PresenceCheck sourcePresenceCheckerReference)
    • getSourceType

      public Type getSourceType()
      Description copied from interface: Assignment
      the source type used in the matching process
      Specified by:
      getSourceType in interface Assignment
      Returns:
      source type (can be null)
    • createUniqueVarName

      public String createUniqueVarName(String desiredName)
      Description copied from interface: Assignment
      Creates an unique safe (local) variable name.
      Specified by:
      createUniqueVarName in interface Assignment
      Parameters:
      desiredName - the desired name
      Returns:
      the desired name, made unique in the scope of the bean mapping.
    • getSourceLocalVarName

      public String getSourceLocalVarName()
      Description copied from interface: Assignment
      Specified by:
      getSourceLocalVarName in interface Assignment
      Returns:
      local variable name (can be null if not set)
    • setSourceLocalVarName

      public void setSourceLocalVarName(String sourceLocalVarName)
      Description copied from interface: Assignment
      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.
      Specified by:
      setSourceLocalVarName in interface Assignment
      Parameters:
      sourceLocalVarName - source local variable name
    • getSourceLoopVarName

      public String getSourceLoopVarName()
      Description copied from interface: Assignment
      See Assignment.getSourceLoopVarName() (java.lang.String) }
      Specified by:
      getSourceLoopVarName in interface Assignment
      Returns:
      loop variable (can be null if not set)
    • setSourceLoopVarName

      public void setSourceLoopVarName(String sourceLoopVarName)
      Description copied from interface: Assignment
      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.
      Specified by:
      setSourceLoopVarName in interface Assignment
      Parameters:
      sourceLoopVarName - loop variable
    • getImportTypes

      public Set<Type> getImportTypes()
      Description copied from class: ModelElement
      Returns a set containing those Types referenced by this model element for which an import statement needs to be declared.
      Specified by:
      getImportTypes in interface Assignment
      Specified by:
      getImportTypes in class ModelElement
      Returns:
      A set with type referenced by this model element. Must not be null.
    • getThrownTypes

      public List<Type> getThrownTypes()
      Description copied from interface: Assignment
      returns all types exception types thrown by this assignment.
      Specified by:
      getThrownTypes in interface Assignment
      Returns:
      exceptions thrown
    • setAssignment

      public void setAssignment(Assignment assignment)
      Description copied from interface: 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
      Specified by:
      setAssignment in interface Assignment
      Parameters:
      assignment - the assignment to set
    • getType

      public Assignment.AssignmentType getType()
      Description copied from interface: Assignment
      Returns whether the type of assignment
      Specified by:
      getType in interface Assignment
      Returns:
      Assignment.AssignmentType
    • isCallingUpdateMethod

      public boolean isCallingUpdateMethod()
      Specified by:
      isCallingUpdateMethod in interface Assignment
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getSourceErrorMessagePart

      public String getSourceErrorMessagePart()
    • getSourceTypeForMatching

      public Type getSourceTypeForMatching()
      The source type that is to be used when resolving the mapping from source to target.
      Returns:
      the source type to be used in the matching process.
    • setUseElementAsSourceTypeForMatching

      public void setUseElementAsSourceTypeForMatching(boolean useElementAsSourceTypeForMatching)
      For collection type, use element as source type to find a suitable mapping method.
      Parameters:
      useElementAsSourceTypeForMatching - uses the element of a collection as source type for the matching process
    • getSourceParameterName

      public String getSourceParameterName()
      Description copied from interface: Assignment
      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
      Specified by:
      getSourceParameterName in interface Assignment
      Returns:
      the source parameter name