Class MapperServiceProcessor
- java.lang.Object
-
- org.mapstruct.ap.internal.processor.MapperServiceProcessor
-
- All Implemented Interfaces:
ModelElementProcessor<Mapper,java.lang.Void>
public class MapperServiceProcessor extends java.lang.Object implements ModelElementProcessor<Mapper,java.lang.Void>
AModelElementProcessorwhich creates files in theMETA-INF/serviceshierarchy for classes with custom implementation class or package name. Service files will only be generated for mappers with the default component model unless force using themapstruct.alwaysGenerateServicesFileoption.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.mapstruct.ap.internal.processor.ModelElementProcessor
ModelElementProcessor.ProcessorContext
-
-
Constructor Summary
Constructors Constructor Description MapperServiceProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcreateSourceFile(ServicesEntry model, ModelWriter modelWriter, javax.annotation.processing.Filer filer)intgetPriority()Returns the priority value of this processor which must be between 1 (highest priority) and 10000 (lowest priority).private ServicesEntrygetServicesEntry(Type mapperType, GeneratedType model)private ServicesEntrygetServicesEntry(Decorator decorator)private ServicesEntrygetServicesEntry(Mapper mapper)java.lang.Voidprocess(ModelElementProcessor.ProcessorContext context, javax.lang.model.element.TypeElement mapperTypeElement, Mapper mapper)Processes the given source element, representing a Java bean mapper in one form or another.private voidwriteToSourceFile(javax.annotation.processing.Filer filer, Mapper model)
-
-
-
Method Detail
-
process
public java.lang.Void process(ModelElementProcessor.ProcessorContext context, javax.lang.model.element.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,java.lang.Void>- 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.
-
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,java.lang.Void>- Returns:
- The priority value of this processor.
-
writeToSourceFile
private void writeToSourceFile(javax.annotation.processing.Filer filer, Mapper model)
-
getServicesEntry
private ServicesEntry getServicesEntry(Mapper mapper)
-
getServicesEntry
private ServicesEntry getServicesEntry(Decorator decorator)
-
getServicesEntry
private ServicesEntry getServicesEntry(Type mapperType, GeneratedType model)
-
createSourceFile
private void createSourceFile(ServicesEntry model, ModelWriter modelWriter, javax.annotation.processing.Filer filer)
-
-