use of org.mapstruct.ap.internal.gem.InjectionStrategyGem in project mapstruct by mapstruct.
the class AnnotationBasedComponentModelProcessor method process.
@Override
public Mapper process(ProcessorContext context, TypeElement mapperTypeElement, Mapper mapper) {
this.typeFactory = context.getTypeFactory();
MapperOptions mapperAnnotation = MapperOptions.getInstanceOn(mapperTypeElement, context.getOptions());
String componentModel = mapperAnnotation.componentModel();
InjectionStrategyGem injectionStrategy = mapperAnnotation.getInjectionStrategy();
if (!getComponentModelIdentifier().equalsIgnoreCase(componentModel)) {
return mapper;
}
for (Annotation typeAnnotation : getTypeAnnotations(mapper)) {
mapper.addAnnotation(typeAnnotation);
}
if (!requiresGenerationOfDecoratorClass()) {
mapper.removeDecorator();
} else if (mapper.getDecorator() != null) {
adjustDecorator(mapper, injectionStrategy);
}
List<Annotation> annotations = getMapperReferenceAnnotations();
ListIterator<Field> iterator = mapper.getFields().listIterator();
while (iterator.hasNext()) {
Field reference = iterator.next();
if (reference instanceof MapperReference) {
iterator.remove();
iterator.add(replacementMapperReference(reference, annotations, injectionStrategy));
}
}
if (injectionStrategy == InjectionStrategyGem.CONSTRUCTOR) {
buildConstructors(mapper);
}
return mapper;
}
Aggregations