Package javax.annotation.processing

Examples of javax.annotation.processing.Processor


    }
    // Cast all the processors here, rather than failing later.
    // But don't call init() until the processor is actually needed.
    _setProcessors = new ArrayList<Processor>(processors.length);
    for (Object o : processors) {
      Processor p = (Processor)o;
      _setProcessors.add(p);
    }
    _setProcessorIter = _setProcessors.iterator();

    // processors set this way take precedence over anything on the command line
View Full Code Here


  @Override
  public ProcessorInfo discoverNextProcessor() {
    if (null != _setProcessors) {
      // If setProcessors() was called, use that list until it's empty and then stop.
      if (_setProcessorIter.hasNext()) {
        Processor p = _setProcessorIter.next();
        p.init(_processingEnv);
        ProcessorInfo pi = new ProcessorInfo(p);
        _processors.add(pi);
        if (_printProcessorDiscovery && null != _out) {
          _out.println("API specified processor: " + pi); //$NON-NLS-1$
        }
        return pi;
      }
      return null;
    }
   
    if (null != _commandLineProcessors) {
      // If there was a -processor option, iterate over processor names,
      // creating and initializing processors, until no more names are found, then stop.
      if (_commandLineProcessorIter.hasNext()) {
        String proc = _commandLineProcessorIter.next();
        try {
          Class<?> clazz = _procLoader.loadClass(proc);
          Object o = clazz.newInstance();
          Processor p = (Processor) o;
          p.init(_processingEnv);
          ProcessorInfo pi = new ProcessorInfo(p);
          _processors.add(pi);
          if (_printProcessorDiscovery && null != _out) {
            _out.println("Command line specified processor: " + pi); //$NON-NLS-1$
          }
          return pi;
        } catch (Exception e) {
          // TODO: better error handling
          throw new AbortCompilation(null, e);
        }
      }
      return null;
    }
   
    // if no processors were explicitly specified with setProcessors()
    // or the command line, search the processor path with ServiceLoader.
    if (null == _serviceLoader ) {
      _serviceLoader = ServiceLoader.load(Processor.class, _procLoader);
      _serviceLoaderIter = _serviceLoader.iterator();
    }
    try {
      if (_serviceLoaderIter.hasNext()) {
        Processor p = _serviceLoaderIter.next();
        p.init(_processingEnv);
        ProcessorInfo pi = new ProcessorInfo(p);
        _processors.add(pi);
        if (_printProcessorDiscovery && null != _out) {
          StringBuilder sb = new StringBuilder();
          sb.append("Discovered processor service "); //$NON-NLS-1$
View Full Code Here

    }
    // Cast all the processors here, rather than failing later.
    // But don't call init() until the processor is actually needed.
    _setProcessors = new ArrayList<Processor>(processors.length);
    for (Object o : processors) {
      Processor p = (Processor)o;
      _setProcessors.add(p);
    }
    _setProcessorIter = _setProcessors.iterator();

    // processors set this way take precedence over anything on the command line
View Full Code Here

TOP

Related Classes of javax.annotation.processing.Processor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.