Package org.mapstruct.ap.internal.model
Class MappingBuilderContext
- java.lang.Object
-
- org.mapstruct.ap.internal.model.MappingBuilderContext
-
public class MappingBuilderContext extends java.lang.ObjectThis class provides the context for the builders.The context provides:
- Input for the building process, such as the source model (mapping methods found) and mapper references.
- Required factory, utility, reporting methods for building the mappings.
- Means to harbor results produced by the builders, such as forged- and supported mapping methods that should be generated in a later stage.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceMappingBuilderContext.MappingResolverResolves the most suitable way for mapping an element (property, iterable element etc.) from source to target.
-
Field Summary
Fields Modifier and Type Field Description private AccessorNamingUtilsaccessorNamingprivate ElementUtilselementUtilsprivate EnumMappingStrategyenumMappingStrategyprivate java.util.Map<java.lang.String,EnumTransformationStrategy>enumTransformationStrategiesprivate java.util.Map<ForgedMethod,ForgedMethod>forgedMethodsUnderCreationprivate java.util.List<MapperReference>mapperReferencesprivate javax.lang.model.element.TypeElementmapperTypeElementprivate MappingBuilderContext.MappingResolvermappingResolverprivate java.util.List<MappingMethod>mappingsToGenerateprivate FormattingMessagermessagerprivate Optionsoptionsprivate java.util.List<SourceMethod>sourceModelprivate static MappingExclusionProviderSUB_MAPPING_EXCLUSION_PROVIDERprivate TypeFactorytypeFactoryprivate TypeUtilstypeUtils
-
Constructor Summary
Constructors Constructor Description MappingBuilderContext(TypeFactory typeFactory, ElementUtils elementUtils, TypeUtils typeUtils, FormattingMessager messager, AccessorNamingUtils accessorNaming, EnumMappingStrategy enumMappingStrategy, java.util.Map<java.lang.String,EnumTransformationStrategy> enumTransformationStrategies, Options options, MappingBuilderContext.MappingResolver mappingResolver, javax.lang.model.element.TypeElement mapper, java.util.List<SourceMethod> sourceModel, java.util.List<MapperReference> mapperReferences)
-
Method Summary
-
-
-
Field Detail
-
SUB_MAPPING_EXCLUSION_PROVIDER
private static final MappingExclusionProvider SUB_MAPPING_EXCLUSION_PROVIDER
-
typeFactory
private final TypeFactory typeFactory
-
elementUtils
private final ElementUtils elementUtils
-
typeUtils
private final TypeUtils typeUtils
-
messager
private final FormattingMessager messager
-
accessorNaming
private final AccessorNamingUtils accessorNaming
-
enumMappingStrategy
private final EnumMappingStrategy enumMappingStrategy
-
enumTransformationStrategies
private final java.util.Map<java.lang.String,EnumTransformationStrategy> enumTransformationStrategies
-
options
private final Options options
-
mapperTypeElement
private final javax.lang.model.element.TypeElement mapperTypeElement
-
sourceModel
private final java.util.List<SourceMethod> sourceModel
-
mapperReferences
private final java.util.List<MapperReference> mapperReferences
-
mappingResolver
private final MappingBuilderContext.MappingResolver mappingResolver
-
mappingsToGenerate
private final java.util.List<MappingMethod> mappingsToGenerate
-
forgedMethodsUnderCreation
private final java.util.Map<ForgedMethod,ForgedMethod> forgedMethodsUnderCreation
-
-
Constructor Detail
-
MappingBuilderContext
public MappingBuilderContext(TypeFactory typeFactory, ElementUtils elementUtils, TypeUtils typeUtils, FormattingMessager messager, AccessorNamingUtils accessorNaming, EnumMappingStrategy enumMappingStrategy, java.util.Map<java.lang.String,EnumTransformationStrategy> enumTransformationStrategies, Options options, MappingBuilderContext.MappingResolver mappingResolver, javax.lang.model.element.TypeElement mapper, java.util.List<SourceMethod> sourceModel, java.util.List<MapperReference> mapperReferences)
-
-
Method Detail
-
getForgedMethodsUnderCreation
public java.util.Map<ForgedMethod,ForgedMethod> getForgedMethodsUnderCreation()
Returns a map which is used to track which forged methods are under creation. Used for cutting the possible infinite recursion of forged method creation. Map is used instead of set because not all fields of ForgedMethods are used in equals/hashCode and we are interested only in the first created ForgedMethod- Returns:
- map of forged methods
-
getMapperTypeElement
public javax.lang.model.element.TypeElement getMapperTypeElement()
-
getSourceModel
public java.util.List<SourceMethod> getSourceModel()
-
getMapperReferences
public java.util.List<MapperReference> getMapperReferences()
-
getTypeFactory
public TypeFactory getTypeFactory()
-
getElementUtils
public ElementUtils getElementUtils()
-
getTypeUtils
public TypeUtils getTypeUtils()
-
getMessager
public FormattingMessager getMessager()
-
getAccessorNaming
public AccessorNamingUtils getAccessorNaming()
-
getEnumMappingStrategy
public EnumMappingStrategy getEnumMappingStrategy()
-
getEnumTransformationStrategies
public java.util.Map<java.lang.String,EnumTransformationStrategy> getEnumTransformationStrategies()
-
getOptions
public Options getOptions()
-
getMappingResolver
public MappingBuilderContext.MappingResolver getMappingResolver()
-
getMappingsToGenerate
public java.util.List<MappingMethod> getMappingsToGenerate()
-
getReservedNames
public java.util.List<java.lang.String> getReservedNames()
-
getExistingMappingMethod
public MappingMethod getExistingMappingMethod(MappingMethod newMappingMethod)
-
getUsedSupportedMappings
public java.util.Set<SupportingMappingMethod> getUsedSupportedMappings()
-
getUsedSupportedFields
public java.util.Set<Field> getUsedSupportedFields()
-
canGenerateAutoSubMappingBetween
public boolean canGenerateAutoSubMappingBetween(Type sourceType, Type targetType)
- Parameters:
sourceType- from which an automatic sub-mapping needs to be generatedtargetType- to which an automatic sub-mapping needs to be generated- Returns:
trueif MapStruct is allowed to try and generate an automatic sub-mapping between the source and targetType
-
canGenerateAutoSubMappingFor
private boolean canGenerateAutoSubMappingFor(Type type)
- Parameters:
type- that MapStruct wants to use to genrate an autoamtic sub-mapping for/from- Returns:
trueif the type is not excluded from theMappingExclusionProvider
-
isErroneous
public boolean isErroneous()
-
-