Class AnnotationBasedComponentModelProcessor
java.lang.Object
org.mapstruct.ap.internal.processor.AnnotationBasedComponentModelProcessor
- All Implemented Interfaces:
ModelElementProcessor<Mapper,Mapper>
- Direct Known Subclasses:
CdiComponentProcessor,JakartaCdiComponentProcessor,JakartaComponentProcessor,Jsr330ComponentProcessor,SpringComponentProcessor
public abstract class AnnotationBasedComponentModelProcessor
extends Object
implements ModelElementProcessor<Mapper,Mapper>
An
ModelElementProcessor which converts the given Mapper object into an annotation based component
model in case a matching model is selected as target component model for this mapper.- Author:
- Gunnar Morling, Andreas Gudian, Kevin Grüneberg
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.mapstruct.ap.internal.processor.ModelElementProcessor
ModelElementProcessor.ProcessorContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanprotected voidadjustDecorator(Mapper mapper, org.mapstruct.ap.internal.gem.InjectionStrategyGem injectionStrategy) protected abstract Stringprotected List<Annotation> getDecoratorAnnotations(Decorator decorator) protected List<Annotation> protected abstract List<Annotation> intReturns the priority value of this processor which must be between 1 (highest priority) and 10000 (lowest priority).protected abstract List<Annotation> getTypeAnnotations(Mapper mapper) protected TypeFactoryprocess(ModelElementProcessor.ProcessorContext context, TypeElement mapperTypeElement, Mapper mapper) Processes the given source element, representing a Java bean mapper in one form or another.protected FieldreplacementMapperReference(Field originalReference, List<Annotation> annotations, org.mapstruct.ap.internal.gem.InjectionStrategyGem injectionStrategy) protected abstract boolean
-
Constructor Details
-
AnnotationBasedComponentModelProcessor
public AnnotationBasedComponentModelProcessor()
-
-
Method Details
-
process
public Mapper process(ModelElementProcessor.ProcessorContext context, TypeElement mapperTypeElement, Mapper mapper) Description copied from interface:ModelElementProcessorProcesses the given source element, representing a Java bean mapper in one form or another.- Specified by:
processin interfaceModelElementProcessor<Mapper,Mapper> - Parameters:
context- Context providing common infrastructure objects.mapperTypeElement- The original type element from which the given mapper object is derived.mapper- The current representation of the bean mapper. Nevernull(the very first processor receives the original type element).- Returns:
- The resulting representation of the bean mapper; may be the same
as the source representation, e.g. if a given implementation just
performs some sort of validity check. Implementations must never
return
nullexcept for the very last processor which generates the resulting Java source file.
-
adjustDecorator
protected void adjustDecorator(Mapper mapper, org.mapstruct.ap.internal.gem.InjectionStrategyGem injectionStrategy) -
additionalPublicEmptyConstructor
protected boolean additionalPublicEmptyConstructor() -
getDelegatorReferenceAnnotations
-
replacementMapperReference
protected Field replacementMapperReference(Field originalReference, List<Annotation> annotations, org.mapstruct.ap.internal.gem.InjectionStrategyGem injectionStrategy) - Parameters:
originalReference- the reference to be replacedannotations- the list of annotationsinjectionStrategy- strategy for injection- Returns:
- the mapper reference replacing the original one
-
getComponentModelIdentifier
- Returns:
- the component model identifier
-
getTypeAnnotations
- Parameters:
mapper- the mapper- Returns:
- the annotation(s) to be added at the mapper type implementation
-
getDecoratorAnnotations
- Returns:
- the annotation(s) to be added at the decorator of the mapper
-
getMapperReferenceAnnotations
- Returns:
- the annotation of the field for the mapper reference
-
requiresGenerationOfDecoratorClass
protected abstract boolean requiresGenerationOfDecoratorClass()- Returns:
- if a decorator (sub-)class needs to be generated or not
-
getPriority
public int getPriority()Description copied from interface:ModelElementProcessorReturns the priority value of this processor which must be between 1 (highest priority) and 10000 (lowest priority). Processors are invoked in order from highest to lowest priority, starting with the mapping method retrieval processor (priority 1) and finishing with the code generation processor (priority 10000). Processors working on the builtMappermodel must have a priority > 1000.- Specified by:
getPriorityin interfaceModelElementProcessor<Mapper,Mapper> - Returns:
- The priority value of this processor.
-
getTypeFactory
-