Class CmdLineProcessor

  extended by javax.annotation.processing.AbstractProcessor
      extended by com.twitter.common.args.apt.CmdLineProcessor
All Implemented Interfaces:

public class CmdLineProcessor
extends AbstractProcessor

Processes @CmdLine annotated fields and @ArgParser and @VerifierFor parser and verifier registrations and stores configuration data listing these fields, parsers and verifiers on the classpath for discovery via Configuration.load().

Supports an apt option useful for some build setups that create monolithic jars aggregating many library jars, one or more of which have embedded arg definitions themselves. By adding the following flag to a javac invocation: -Acom.twitter.common.args.apt.CmdLineProcessor.main you signal this apt processor that the compilation target is a leaf target that will comprise one or more executable mains (as opposed to a library jar). As a result, the embedded arg definitions generated will occupy a special resource that is always checked for first during runtime arg parsing.

Field Summary
Fields inherited from class javax.annotation.processing.AbstractProcessor
Constructor Summary
Method Summary
 Set<String> getSupportedAnnotationTypes()
 void init(ProcessingEnvironment processingEnv)
 boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv)
Methods inherited from class javax.annotation.processing.AbstractProcessor
getCompletions, getSupportedOptions, getSupportedSourceVersion, isInitialized
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public CmdLineProcessor()
Method Detail


public void init(ProcessingEnvironment processingEnv)
Specified by:
init in interface Processor
init in class AbstractProcessor


public Set<String> getSupportedAnnotationTypes()
Specified by:
getSupportedAnnotationTypes in interface Processor
getSupportedAnnotationTypes in class AbstractProcessor


public boolean process(Set<? extends TypeElement> annotations,
                       RoundEnvironment roundEnv)
Specified by:
process in interface Processor
Specified by:
process in class AbstractProcessor