Java 8 ProcessingEnvironment - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 ProcessingEnvironment class.

This code example shows how to use the following methods:getElementUtils, getOptions, getTypeUtils
     */ 
    public void run(ProcessingEnvironment pEnv, RoundEnvironment rEnv) {
        this.env = new OperatorCompilingEnvironment(
                pEnv,
                Models.getModelFactory(), 
                OperatorCompilerOptions.parse(pEnv.getOptions()));
        this.round = rEnv;
        this.types = pEnv.getTypeUtils();
        this.elements = pEnv.getElementUtils();
        try { 
            test(); 
        } catch (RuntimeException e) {
            this.runtimeException = e;
        } catch (Error e) {
            this.error = e;
        } 
    } 
 
    /** 
     * {@link #test()}で実行されたエラーをスローする。 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getElementUtils
  } 
 
  @Override public Binding<?> getAtInjectBinding( 
      String key, String className, ClassLoader classLoader, boolean mustHaveInjections) {
    String sourceClassName = className.replace('$', '.');
    TypeElement type = processingEnv.getElementUtils().getTypeElement(sourceClassName);
    if (type == null) {
      // We've encountered a type that the compiler can't introspect. If this 
      // causes problems in practice (due to incremental compiles, etc.) we 
      // should return a new unresolved binding and warn about the possibility 
      // of runtime failures. 
      return null; 
    } 
    if (type.getKind() == ElementKind.INTERFACE) {
      return null; 
    } 
    return GraphAnalysisInjectBinding.create(type, mustHaveInjections);
  } 
 
  @Override public <T> ModuleAdapter<T> getModuleAdapter(Class<T> moduleClass) {
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getElementUtils, getFiler, getMessager
        log.getParent().setLevel(FeatureFlip.LOG_LEVEL); 
    } 
     
    @Override 
    public void init(ProcessingEnvironment env) {
        filer = env.getFiler();
        messager = env.getMessager();
        elements = env.getElementUtils();
    } 
 
    @Override 
    public boolean process(final Set<? extends TypeElement> annotations, final RoundEnvironment roundEnvironment) {
        // Get all classes that has the annotation 
        Set<? extends Element> classElements = roundEnvironment.getElementsAnnotatedWith(BoundBox.class);
        // For each class that has the annotation 
        for (final Element classElement : classElements) {
             
            // Get the annotation information 
            TypeElement boundClass = null;
            String maxSuperClass = null;
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getElementUtils
	public AndroidRClassFinder(ProcessingEnvironment processingEnv) {
		this.processingEnv = processingEnv;
	} 
 
	public Option<IRClass> find() {
		Elements elementUtils = processingEnv.getElementUtils();
		TypeElement androidRType = elementUtils.getTypeElement("android.R");
		if (androidRType == null) {
			LOGGER.error("The android.R class cannot be found"); 
			return Option.absent();
		} 
 
		LOGGER.info("Found Android class: {}", androidRType.toString());
 
		return Option.<IRClass> of(new RClass(androidRType));
	} 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getElementUtils, getTypeUtils
     */ 
    @SuppressWarnings("hiding") 
    public void run(ProcessingEnvironment env, RoundEnvironment round) {
        this.env = env;
        this.round = round;
        this.types = env.getTypeUtils();
        this.elements = env.getElementUtils();
        try { 
            test(); 
        } catch (RuntimeException e) {
            this.runtimeException = e;
        } catch (Error e) {
            this.error = e;
        } 
    } 
 
    /** 
     * {@link #test()}で実行されたエラーをスローする。 
     */ 
    public void rethrow() { 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getElementUtils, getFiler, getMessager, getTypeUtils
 
    @Override 
    protected void configure() { 
        ProcessingEnvironment environment = entrypoint.getProcessingEnvironment();
 
        bind(ProcessingEnvironment.class).toInstance(environment);
        bind(Messager.class).toInstance(environment.getMessager());
        bind(Filer.class).toInstance(environment.getFiler());
        bind(Types.class).toInstance(environment.getTypeUtils());
        bind(Elements.class).toInstance(environment.getElementUtils());
 
        bind(RoundEnvironment.class).toInstance(roundEnvironment);
 
        bind(Reflections.class).toInstance(reflections);
 
        bind(TypeHelper.class).to(TypeHelperImpl.class); 
        bind(MarshallerRegistry.class).to(MarshallerRegistryImpl.class).in(Singleton.class); 
        bind(FeatureProviderRegistry.class).to(FeatureProviderRegistryImpl.class).in(Singleton.class); 
 
        bind(EntityParser.class).to(EntityParserImpl.class); 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getElementUtils, getFiler, getMessager
	private TypeElement _annoDecl;
	 
	@Override 
	public synchronized void init(ProcessingEnvironment processingEnv) {
		super.init(processingEnv);
		_filer = processingEnv.getFiler();
		_messager = processingEnv.getMessager();
		_elementUtil = processingEnv.getElementUtils();
		_annoDecl = _elementUtil.getTypeElement("org.eclipse.jdt.compiler.apt.tests.annotations.GenClass");
		 
		//System.out.println("Processor options are: "); 
		//for (Map.Entry<String, String> option : processingEnv.getOptions().entrySet()) { 
		//	System.out.println(option.getKey() + " -> " + option.getValue()); 
		//} 
	} 
 
	@Override 
	public boolean process(Set<? extends TypeElement> annotations,
			RoundEnvironment roundEnv) {
		 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getClass, getMessager
 
    @Override 
    public synchronized void init( @SuppressWarnings( "hiding" ) ProcessingEnvironment processingEnv )
    { 
        super.init( processingEnv );
        manipulator = CompilationManipulator.load( this, processingEnv );
        if ( manipulator == null )
            processingEnv.getMessager().printMessage( Kind.NOTE,
                    "Cannot write values to this compiler: " + processingEnv.getClass().getName() );
    } 
 
    @Override 
    public boolean process( Set<? extends TypeElement> annotations, RoundEnvironment roundEnv )
    { 
        for ( TypeElement type : annotations )
        { 
            for ( Element annotated : roundEnv.getElementsAnnotatedWith( type ) )
            { 
                for ( AnnotationMirror mirror : annotated.getAnnotationMirrors() )
                { 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getElementUtils, getTypeUtils
 
		this.messager = messager;
		this.verbose = configuration.isVerbose();
 
		AnnotationApiHelper annotationApiHelper = new AnnotationApiHelper(
				processingEnvironment.getElementUtils(), processingEnvironment.getTypeUtils()
		); 
 
		ConstraintHelper constraintHelper = new ConstraintHelper(
				processingEnvironment.getTypeUtils(), annotationApiHelper
		); 
 
		constraintCheckFactory = new ConstraintCheckFactory(
				processingEnvironment.getTypeUtils(),
				constraintHelper,
				annotationApiHelper,
				configuration.methodConstraintsSupported() 
		); 
	} 
 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getMessager, getOptions
	@Override 
	public synchronized void init(ProcessingEnvironment processingEnv) {
 
		super.init( processingEnv );
 
		configuration = new Configuration( processingEnv.getOptions(), processingEnv.getMessager() );
		messager = new MessagerAdapter( processingEnv.getMessager(), configuration.getDiagnosticKind() );
	} 
 
	@Override 
	public SourceVersion getSupportedSourceVersion() {
		return SourceVersion.latestSupported();
	} 
 
	@Override 
	public boolean process( 
			final Set<? extends TypeElement> annotations,
			final RoundEnvironment roundEnvironment) {
 
		AnnotationApiHelper typeHelper = new AnnotationApiHelper(
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 ProcessingEnvironment Methods: