Search in sources :

Example 1 with Generator

use of org.robolectric.annotation.processing.generator.Generator in project robolectric by robolectric.

the class RobolectricProcessor method process.

@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    for (TypeElement annotation : annotations) {
        Validator validator = elementValidators.get(annotation);
        if (validator != null) {
            for (Element elem : roundEnv.getElementsAnnotatedWith(annotation)) {
                validator.visit(elem, elem.getEnclosingElement());
            }
        }
    }
    if (!generated && shadowPackage != null) {
        model.prepare();
        for (Generator generator : generators) {
            generator.generate(shadowPackage);
        }
        generated = true;
    }
    return true;
}
Also used : TypeElement(javax.lang.model.element.TypeElement) Element(javax.lang.model.element.Element) TypeElement(javax.lang.model.element.TypeElement) ImplementationValidator(org.robolectric.annotation.processing.validator.ImplementationValidator) ImplementsValidator(org.robolectric.annotation.processing.validator.ImplementsValidator) ResetterValidator(org.robolectric.annotation.processing.validator.ResetterValidator) Validator(org.robolectric.annotation.processing.validator.Validator) RealObjectValidator(org.robolectric.annotation.processing.validator.RealObjectValidator) Generator(org.robolectric.annotation.processing.generator.Generator) ShadowProviderGenerator(org.robolectric.annotation.processing.generator.ShadowProviderGenerator) ServiceLoaderGenerator(org.robolectric.annotation.processing.generator.ServiceLoaderGenerator)

Aggregations

Element (javax.lang.model.element.Element)1 TypeElement (javax.lang.model.element.TypeElement)1 Generator (org.robolectric.annotation.processing.generator.Generator)1 ServiceLoaderGenerator (org.robolectric.annotation.processing.generator.ServiceLoaderGenerator)1 ShadowProviderGenerator (org.robolectric.annotation.processing.generator.ShadowProviderGenerator)1 ImplementationValidator (org.robolectric.annotation.processing.validator.ImplementationValidator)1 ImplementsValidator (org.robolectric.annotation.processing.validator.ImplementsValidator)1 RealObjectValidator (org.robolectric.annotation.processing.validator.RealObjectValidator)1 ResetterValidator (org.robolectric.annotation.processing.validator.ResetterValidator)1 Validator (org.robolectric.annotation.processing.validator.Validator)1