Class Field

All Implemented Interfaces:
Writable
Direct Known Subclasses:
MapperReference, SupportingField

public class Field extends ModelElement
A field of a mapper type, e.g. a reference to another mapper.
Author:
Gunnar Morling
  • Constructor Details

    • Field

      public Field(Type type, String variableName, boolean used)
    • Field

      public Field(Type type, String variableName)
  • Method Details

    • getType

      public Type getType()
      Returns the type of this field.
      Returns:
      the type of this field
    • getVariableName

      public String getVariableName()
      Returns the variable name of this field.
      Returns:
      the variable name of this reference
    • 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 class ModelElement
      Returns:
      A set with type referenced by this model element. Must not be null.
    • isUsed

      public boolean isUsed()
      indicates whether the field is indeed used
      Returns:
      true when field is used
    • setUsed

      public void setUsed(boolean isUsed)
      sets the field as being used
      Parameters:
      isUsed - must be true when being used.
    • isTypeRequiresImport

      public boolean isTypeRequiresImport()
      field needs to be imported
      Returns:
      true if the type should be included in the import of the generated type
    • setTypeRequiresImport

      public void setTypeRequiresImport(boolean typeRequiresImport)
      set field needs to be imported
      Parameters:
      typeRequiresImport - needs to be imported
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getFieldNames

      public static List<String> getFieldNames(Set<Field> fields)