Class MappingBuilderContext


  • public class MappingBuilderContext
    extends java.lang.Object
    This 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.
    • 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()
      • getTypeUtils

        public TypeUtils getTypeUtils()
      • getEnumTransformationStrategies

        public java.util.Map<java.lang.String,​EnumTransformationStrategy> getEnumTransformationStrategies()
      • getOptions

        public Options getOptions()
      • getMappingsToGenerate

        public java.util.List<MappingMethod> getMappingsToGenerate()
      • getReservedNames

        public java.util.List<java.lang.String> getReservedNames()
      • 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 generated
        targetType - to which an automatic sub-mapping needs to be generated
        Returns:
        true if MapStruct is allowed to try and generate an automatic sub-mapping between the source and target Type
      • canGenerateAutoSubMappingFor

        private boolean canGenerateAutoSubMappingFor​(Type type)
        Parameters:
        type - that MapStruct wants to use to genrate an autoamtic sub-mapping for/from
        Returns:
        true if the type is not excluded from the MappingExclusionProvider
      • isErroneous

        public boolean isErroneous()