Search in sources :

Example 1 with AnnotationProcessingException

use of org.mapstruct.ap.internal.util.AnnotationProcessingException in project mapstruct by mapstruct.

the class MethodRetrievalProcessor method process.

@Override
public List<SourceMethod> process(ProcessorContext context, TypeElement mapperTypeElement, Void sourceModel) {
    this.messager = context.getMessager();
    this.typeFactory = context.getTypeFactory();
    this.accessorNaming = context.getAccessorNaming();
    this.typeUtils = context.getTypeUtils();
    this.elementUtils = context.getElementUtils();
    this.enumTransformationStrategies = context.getEnumTransformationStrategies();
    this.options = context.getOptions();
    this.messager.note(0, Message.PROCESSING_NOTE, mapperTypeElement);
    MapperOptions mapperOptions = MapperOptions.getInstanceOn(mapperTypeElement, context.getOptions());
    if (mapperOptions.hasMapperConfig()) {
        this.messager.note(0, Message.CONFIG_NOTE, mapperOptions.mapperConfigType().asElement().getSimpleName());
    }
    if (!mapperOptions.isValid()) {
        throw new AnnotationProcessingException("Couldn't retrieve @Mapper annotation", mapperTypeElement, mapperOptions.getAnnotationMirror());
    }
    List<SourceMethod> prototypeMethods = retrievePrototypeMethods(mapperTypeElement, mapperOptions);
    return retrieveMethods(mapperTypeElement, mapperTypeElement, mapperOptions, prototypeMethods);
}
Also used : MapperOptions(org.mapstruct.ap.internal.model.source.MapperOptions) AnnotationProcessingException(org.mapstruct.ap.internal.util.AnnotationProcessingException) SourceMethod(org.mapstruct.ap.internal.model.source.SourceMethod)

Aggregations

MapperOptions (org.mapstruct.ap.internal.model.source.MapperOptions)1 SourceMethod (org.mapstruct.ap.internal.model.source.SourceMethod)1 AnnotationProcessingException (org.mapstruct.ap.internal.util.AnnotationProcessingException)1