| java.lang.Object org.apache.beehive.netui.compiler.Diagnostics org.apache.beehive.netui.compiler.processor.TwoPhaseCoreAnnotationProcessor
All known Subclasses: org.apache.beehive.netui.compiler.processor.BaseCoreAnnotationProcessor,
TwoPhaseCoreAnnotationProcessor | abstract public class TwoPhaseCoreAnnotationProcessor extends Diagnostics implements CoreAnnotationProcessor(Code) | | The TwoPhaseCoreAnnotationProcessor class is an abstract class that implements the APT
CoreAnnotationProcessor interface. It breaks the work of the process() method of the
CoreAnnotationProcessor down into two distinct phases, represented as abstract method
of TwoPhaseCoreAnnotationProcessor that are to be implemented by concrete subclasses.
The two phases of processing are:
The check phase is used to validate input Declarations that have been
annotated with annotations claimed by the processor to ensure that it
is semantically valid. If the presence of the input Declaration implies the need
to add new files, and those files need to be visible during the check phase for
other Declarations, then the CoreAnnotationProcessorEnv's Filer API should be
used to add those files in this phase. The adding of such files at this point
should typically not result in their emission to persistent storage (i.e. disk),
but rather be kept in memory to be referenced by the check phase of other
Declarations.
The generate phase will actually emit any source, binary, or class files
that are derived from the input Declaration, including files added via the Filer
API during the check phase. The Filer API may also be used in this phase to add
new files, however, such additions will not be visible during the check phase of
any Declarations.
The benefits of breaking process() down into check() and generate() phases are:
Makes it possible to perform the semantic validation of Declarations without
necessarily resulting in code generation.
Provides a clearer association between input Declarations and generator output.
TwoPhaseCoreAnnotationProcessor is intended provide a uniform mechanism for writing
CoreAnnotationProcessor implementations that can be used in tooling environments more
sophisticated than command-line tools (that may not do all their work on source
in a single pass). Such environments will typically also provide implementations
of the CoreAnnotationProcessorEnv and associated interfaces (Messager,
Filer etc).
|
Method Summary | |
public void | check() Performs semantic validation of input Declarations that are annotated with
annotations claimed by this CoreAnnotationProcessor. | protected void | check(Collection decls) | abstract public void | check(Declaration decl) The check method is responsible for all semantic validation of the input Declaration.
All semantic errors/warnings associated with the input Declaration should
be output during check via methods on
Diagnostics .
If the presence of the input Declaration implies the need to add new files,
and those files need to be visible during the check phase for
other Declarations, then the CoreAnnotationProcessorEnv's Filer API should be
used to add those files in this phase. | public void | generate() Emits additional artifacts for input Declarations that are annotated with
annotations claimed by this CoreAnnotationProcessor. | abstract public void | generate(Declaration decl) The generate method is responsible for the generation of any additional artifacts
(source, class, or binary) that are derived from the input Declaration. | protected String | getResourceString(String id, Object[] args) | public void | process() Implements CoreAnnotationProcessor.process() as two phases, "check" and "generate". |
check | public void check() throws FatalCompileTimeException(Code) | | Performs semantic validation of input Declarations that are annotated with
annotations claimed by this CoreAnnotationProcessor.
|
check | abstract public void check(Declaration decl) throws FatalCompileTimeException(Code) | | The check method is responsible for all semantic validation of the input Declaration.
All semantic errors/warnings associated with the input Declaration should
be output during check via methods on
Diagnostics .
If the presence of the input Declaration implies the need to add new files,
and those files need to be visible during the check phase for
other Declarations, then the CoreAnnotationProcessorEnv's Filer API should be
used to add those files in this phase. The adding of such files at this point
should typically not result in their emission to persistent storage (i.e. disk),
but rather be kept in memory to be referenced by the check phase of other
Declarations.
|
generate | public void generate()(Code) | | Emits additional artifacts for input Declarations that are annotated with
annotations claimed by this CoreAnnotationProcessor.
|
generate | abstract public void generate(Declaration decl) throws FatalCompileTimeException(Code) | | The generate method is responsible for the generation of any additional artifacts
(source, class, or binary) that are derived from the input Declaration.
|
process | public void process()(Code) | | Implements CoreAnnotationProcessor.process() as two phases, "check" and "generate".
"generate" will not be called if "check" emitted any errors (via printError()).
|
Methods inherited from org.apache.beehive.netui.compiler.Diagnostics | public void addError(Declaration decl, String messageKey)(Code)(Java Doc) public void addError(Declaration decl, String messageKey, Object arg)(Code)(Java Doc) public void addError(Declaration decl, String messageKey, Object arg1, Object arg2)(Code)(Java Doc) public void addError(Declaration decl, String messageKey, Object arg1, Object arg2, Object arg3)(Code)(Java Doc) public void addError(AnnotationInstance ann, String messageKey)(Code)(Java Doc) public void addError(AnnotationInstance ann, String messageKey, Object arg)(Code)(Java Doc) public void addError(AnnotationInstance ann, String messageKey, Object arg1, Object arg2)(Code)(Java Doc) public void addError(AnnotationInstance ann, String messageKey, Object arg1, Object arg2, Object arg3)(Code)(Java Doc) public void addError(AnnotationValue value, String messageKey)(Code)(Java Doc) public void addError(AnnotationValue value, String messageKey, Object arg)(Code)(Java Doc) public void addError(AnnotationValue value, String messageKey, Object arg1, Object arg2)(Code)(Java Doc) public void addError(AnnotationValue value, String messageKey, Object arg1, Object arg2, Object arg3)(Code)(Java Doc) public void addErrorArrayArgs(Declaration decl, String messageKey, Object[] args)(Code)(Java Doc) public void addErrorArrayArgs(AnnotationInstance ann, String messageKey, Object[] args)(Code)(Java Doc) public void addErrorArrayArgs(AnnotationValue value, String messageKey, Object[] args)(Code)(Java Doc) public void addErrorNoPosition(String messageKey, Object[] args)(Code)(Java Doc) public void addWarning(Declaration decl, String messageKey)(Code)(Java Doc) public void addWarning(Declaration decl, String messageKey, Object arg)(Code)(Java Doc) public void addWarning(Declaration decl, String messageKey, Object arg1, Object arg2)(Code)(Java Doc) public void addWarning(Declaration decl, String messageKey, Object arg1, Object arg2, Object arg3)(Code)(Java Doc) public void addWarning(AnnotationInstance ann, String messageKey)(Code)(Java Doc) public void addWarning(AnnotationInstance ann, String messageKey, Object arg)(Code)(Java Doc) public void addWarning(AnnotationInstance ann, String messageKey, Object arg1, Object arg2)(Code)(Java Doc) public void addWarning(AnnotationInstance ann, String messageKey, Object arg1, Object arg2, Object arg3)(Code)(Java Doc) public void addWarning(AnnotationValue value, String messageKey)(Code)(Java Doc) public void addWarning(AnnotationValue value, String messageKey, Object arg)(Code)(Java Doc) public void addWarning(AnnotationValue value, String messageKey, Object arg1, Object arg2)(Code)(Java Doc) public void addWarning(AnnotationValue value, String messageKey, Object arg1, Object arg2, Object arg3)(Code)(Java Doc) public void addWarningArrayArgs(Declaration decl, String messageKey, Object[] args)(Code)(Java Doc) public void addWarningArrayArgs(AnnotationInstance ann, String messageKey, Object[] args)(Code)(Java Doc) public void addWarningArrayArgs(AnnotationValue value, String messageKey, Object[] args)(Code)(Java Doc) protected CoreAnnotationProcessorEnv getAnnotationProcessorEnvironment()(Code)(Java Doc) abstract protected String getResourceString(String key, Object[] args)(Code)(Java Doc) public boolean hasErrors()(Code)(Java Doc) protected void setHasErrors(boolean hadErrors)(Code)(Java Doc)
|
|
|