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.- Author:
- Gunnar Morling
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.mapstruct.ap.internal.writer.Writable
Writable.Context
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
static List<String>
getFieldNames(Set<Field> fields)
Set<Type>
getImportTypes()
Returns a set containing thoseType
s referenced by this model element for which an import statement needs to be declared.Type
getType()
Returns the type of this field.String
getVariableName()
Returns the variable name of this field.int
hashCode()
boolean
isTypeRequiresImport()
field needs to be importedboolean
isUsed()
indicates whether the field is indeed usedvoid
setTypeRequiresImport(boolean typeRequiresImport)
set field needs to be importedvoid
setUsed(boolean isUsed)
sets the field as being used-
Methods inherited from class org.mapstruct.ap.internal.writer.FreeMarkerWritable
getTemplateName, getTemplateNameForClass, write
-
-
-
-
Method Detail
-
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 thoseType
s referenced by this model element for which an import statement needs to be declared.- Specified by:
getImportTypes
in 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
-
-