Search in sources :

Example 1 with HandlerAnnotationValidator

use of com.github.mvp4g.mvp4g2.processor.scanner.validation.HandlerAnnotationValidator in project mvp4g2 by mvp4g.

the class HandlerAnnotationScanner method scan.

public HandlerMetaModel scan(RoundEnvironment roundEnvironment) throws ProcessorException {
    // Validator
    HandlerAnnotationValidator validator = HandlerAnnotationValidator.builder().roundEnvironment(roundEnvironment).processingEnvironment(processingEnvironment).build();
    // read all already created model
    HandlerMetaModel model = this.restore();
    for (Element element : roundEnvironment.getElementsAnnotatedWith(Handler.class)) {
        TypeElement typeElement = (TypeElement) element;
        // validate the element. In case of error throw exception!
        validator.validate(typeElement);
        // update model
        model.add(((TypeElement) element).getQualifiedName().toString(), this.processorUtils.createHandledEventArray(typeElement));
    }
    // let's store the updated model
    this.processorUtils.store(model, this.createRelativeFileName());
    return model;
}
Also used : HandlerMetaModel(com.github.mvp4g.mvp4g2.processor.model.HandlerMetaModel) TypeElement(javax.lang.model.element.TypeElement) Element(javax.lang.model.element.Element) TypeElement(javax.lang.model.element.TypeElement) HandlerAnnotationValidator(com.github.mvp4g.mvp4g2.processor.scanner.validation.HandlerAnnotationValidator)

Aggregations

HandlerMetaModel (com.github.mvp4g.mvp4g2.processor.model.HandlerMetaModel)1 HandlerAnnotationValidator (com.github.mvp4g.mvp4g2.processor.scanner.validation.HandlerAnnotationValidator)1 Element (javax.lang.model.element.Element)1 TypeElement (javax.lang.model.element.TypeElement)1