com.twitter.common.args.apt
Class CmdLineProcessor

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

@SupportedSourceVersion(value=RELEASE_6)
@SupportedOptions(value={"com.twitter.common.args.apt.CmdLineProcessor.main","com.twitter.common.args.apt.CmdLineProcessor.check_linkage"})
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
processingEnv
 
Constructor Summary
CmdLineProcessor()
           
 
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

CmdLineProcessor

public CmdLineProcessor()
Method Detail

init

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

getSupportedAnnotationTypes

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

process

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