Package org.mapstruct.ap.internal.model
Class Field
- java.lang.Object
-
- org.mapstruct.ap.internal.writer.FreeMarkerWritable
-
- org.mapstruct.ap.internal.model.common.ModelElement
-
- org.mapstruct.ap.internal.model.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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.mapstruct.ap.internal.writer.Writable
Writable.Context
-
-
Field Summary
Fields Modifier and Type Field Description private Typetypeprivate booleantypeRequiresImportprivate booleanusedprivate java.lang.StringvariableName
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)static java.util.List<java.lang.String>getFieldNames(java.util.Set<Field> fields)java.util.Set<Type>getImportTypes()Returns a set containing thoseTypes referenced by this model element for which an import statement needs to be declared.TypegetType()Returns the type of this field.java.lang.StringgetVariableName()Returns the variable name of this field.inthashCode()booleanisTypeRequiresImport()field needs to be importedbooleanisUsed()indicates whether the field is indeed usedvoidsetTypeRequiresImport(boolean typeRequiresImport)set field needs to be importedvoidsetUsed(boolean isUsed)sets the field as being used-
Methods inherited from class org.mapstruct.ap.internal.writer.FreeMarkerWritable
getTemplateName, getTemplateNameForClass, write
-
-
-
-
Field Detail
-
type
private final Type type
-
variableName
private final java.lang.String variableName
-
used
private boolean used
-
typeRequiresImport
private boolean typeRequiresImport
-
-
Method Detail
-
getType
public Type getType()
Returns the type of this field.- Returns:
- the type of this field
-
getVariableName
public java.lang.String getVariableName()
Returns the variable name of this field.- Returns:
- the variable name of this reference
-
getImportTypes
public java.util.Set<Type> getImportTypes()
Description copied from class:ModelElementReturns a set containing thoseTypes referenced by this model element for which an import statement needs to be declared.- Specified by:
getImportTypesin classModelElement- 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:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
getFieldNames
public static java.util.List<java.lang.String> getFieldNames(java.util.Set<Field> fields)
-
-