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 booleanequals(Object obj)static List<String>getFieldNames(Set<Field> fields)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.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
-
-
-
-
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: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
-
-