Search in sources :

Example 1 with PresenterAnnotationValidator

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

the class PresenterAnnotationScanner method scan.

public PresenterMetaModel scan(RoundEnvironment roundEnvironment) throws ProcessorException {
    // Validator
    PresenterAnnotationValidator validator = PresenterAnnotationValidator.builder().processingEnvironment(processingEnvironment).build();
    // read all already created model
    PresenterMetaModel model = this.restore();
    // iterate over Presenter
    for (Element element : roundEnvironment.getElementsAnnotatedWith(Presenter.class)) {
        TypeElement typeElement = (TypeElement) element;
        // validate
        validator.validate(typeElement, this.getViewClassTypeElement(typeElement.getAnnotation(Presenter.class)), this.getViewInterfaceTypeElement(typeElement.getAnnotation(Presenter.class)));
        // update model
        model.add(((TypeElement) element).getQualifiedName().toString(), typeElement.getAnnotation(Presenter.class).multiple() ? "true" : "false", this.processorUtils.extendsClassOrInterface(this.processingEnvironment.getTypeUtils(), typeElement.asType(), this.processingEnvironment.getElementUtils().getTypeElement(IsShell.class.getCanonicalName()).asType()) ? "true" : "false", this.getViewClassTypeElement(element.getAnnotation(Presenter.class)).getQualifiedName().toString(), this.getViewInterfaceTypeElement(element.getAnnotation(Presenter.class)).getQualifiedName().toString(), typeElement.getAnnotation(Presenter.class).viewCreator().toString(), this.processorUtils.createHandledEventArray(typeElement));
    }
    // let's store the updated model
    this.processorUtils.store(model, this.createRelativeFileName());
    return model;
}
Also used : IsShell(com.github.mvp4g.mvp4g2.core.ui.IsShell) PresenterMetaModel(com.github.mvp4g.mvp4g2.processor.model.PresenterMetaModel) TypeElement(javax.lang.model.element.TypeElement) Presenter(com.github.mvp4g.mvp4g2.core.ui.annotation.Presenter) Element(javax.lang.model.element.Element) TypeElement(javax.lang.model.element.TypeElement) PresenterAnnotationValidator(com.github.mvp4g.mvp4g2.processor.scanner.validation.PresenterAnnotationValidator)

Aggregations

IsShell (com.github.mvp4g.mvp4g2.core.ui.IsShell)1 Presenter (com.github.mvp4g.mvp4g2.core.ui.annotation.Presenter)1 PresenterMetaModel (com.github.mvp4g.mvp4g2.processor.model.PresenterMetaModel)1 PresenterAnnotationValidator (com.github.mvp4g.mvp4g2.processor.scanner.validation.PresenterAnnotationValidator)1 Element (javax.lang.model.element.Element)1 TypeElement (javax.lang.model.element.TypeElement)1