public abstract class AbstractIncrementalGenerator
extends com.google.gwt.core.ext.IncrementalGenerator
IncrementalGenerator
s for GWT environments, that generates a
Class
from a single input type. If the input type has not been modified since the last generation the
generated result is reused by default
.Constructor and Description |
---|
AbstractIncrementalGenerator()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
protected String |
createClassName(com.google.gwt.core.ext.typeinfo.JClassType inputType)
This method creates the
simple name of the Class to generate. |
protected String |
generate(com.google.gwt.core.ext.typeinfo.JClassType inputType,
com.google.gwt.core.ext.TreeLogger logger,
com.google.gwt.core.ext.GeneratorContext context)
This method performs the actual generation of the
Class to rebind. |
protected abstract void |
generateClassContents(com.google.gwt.core.ext.typeinfo.JClassType inputType,
com.google.gwt.core.ext.TreeLogger logger,
com.google.gwt.user.rebind.SourceWriter sourceWriter,
String simpleName,
com.google.gwt.core.ext.GeneratorContext context)
This method generates the actual contents of the
Class to generate. |
protected abstract void |
generateClassDeclaration(com.google.gwt.core.ext.typeinfo.JClassType inputType,
com.google.gwt.core.ext.TreeLogger logger,
com.google.gwt.user.rebind.ClassSourceFileComposerFactory sourceComposerFactory,
com.google.gwt.core.ext.GeneratorContext context)
This method generates the additional things for the class declaration.
|
protected void |
generateDefaultConstructor(com.google.gwt.user.rebind.SourceWriter sourceWriter,
String simpleName)
Generates the the default constructor.
|
protected abstract void |
generateImportStatements(com.google.gwt.core.ext.typeinfo.JClassType inputType,
com.google.gwt.core.ext.TreeLogger logger,
com.google.gwt.user.rebind.ClassSourceFileComposerFactory sourceComposerFactory,
com.google.gwt.core.ext.GeneratorContext context)
This method generates the import statements.
|
com.google.gwt.core.ext.RebindResult |
generateIncrementally(com.google.gwt.core.ext.TreeLogger logger,
com.google.gwt.core.ext.GeneratorContext context,
String typeName) |
protected void |
generateSourceCloseBlock(com.google.gwt.user.rebind.SourceWriter sourceWriter)
This method generates the source code to close a block (method body, if-block, while-block, etc.).
|
protected void |
generateSourcePublicConstructorDeclaration(com.google.gwt.user.rebind.SourceWriter sourceWriter,
String methodName)
This method generates the source code for a public method or constructor including the opening brace and
indentation.
|
protected void |
generateSourcePublicMethodDeclaration(com.google.gwt.user.rebind.SourceWriter sourceWriter,
com.google.gwt.core.ext.typeinfo.JMethod method)
This method generates the source code for a public method declaration including the opening brace and indentation.
|
protected void |
generateSourcePublicMethodDeclaration(com.google.gwt.user.rebind.SourceWriter sourceWriter,
String returnType,
String methodName,
String arguments,
boolean override)
This method generates the source code for a public method or constructor including the opening brace and
indentation.
|
protected boolean |
isCachedResultObsolete(com.google.gwt.core.ext.CachedGeneratorResult cachedGeneratorResult,
String typeName)
This method determines whether a
CachedGeneratorResult is obsolete or can be reused. |
public AbstractIncrementalGenerator()
public com.google.gwt.core.ext.RebindResult generateIncrementally(com.google.gwt.core.ext.TreeLogger logger, com.google.gwt.core.ext.GeneratorContext context, String typeName) throws com.google.gwt.core.ext.UnableToCompleteException
generateIncrementally
in class com.google.gwt.core.ext.IncrementalGenerator
com.google.gwt.core.ext.UnableToCompleteException
protected String generate(com.google.gwt.core.ext.typeinfo.JClassType inputType, com.google.gwt.core.ext.TreeLogger logger, com.google.gwt.core.ext.GeneratorContext context)
Class
to rebind.inputType
- is the JClassType
reflecting the input-type that triggered the generation via
GWT.create(Class)
.logger
- is the TreeLogger
.context
- is the GeneratorContext
.protected abstract void generateImportStatements(com.google.gwt.core.ext.typeinfo.JClassType inputType, com.google.gwt.core.ext.TreeLogger logger, com.google.gwt.user.rebind.ClassSourceFileComposerFactory sourceComposerFactory, com.google.gwt.core.ext.GeneratorContext context)
ClassSourceFileComposerFactory.addImport(String)
to the given ClassSourceFileComposerFactory
.inputType
- is the JClassType
reflecting the input-type that triggered the generation via
GWT.create(Class)
.logger
- is the TreeLogger
.sourceComposerFactory
- is the ClassSourceFileComposerFactory
.context
- is the GeneratorContext
.protected abstract void generateClassDeclaration(com.google.gwt.core.ext.typeinfo.JClassType inputType, com.google.gwt.core.ext.TreeLogger logger, com.google.gwt.user.rebind.ClassSourceFileComposerFactory sourceComposerFactory, com.google.gwt.core.ext.GeneratorContext context)
ClassSourceFileComposerFactory.setSuperclass(String)
ClassSourceFileComposerFactory.addImplementedInterface(String)
ClassSourceFileComposerFactory.addAnnotationDeclaration(String)
ClassSourceFileComposerFactory.makeInterface()
ClassSourceFileComposerFactory.setJavaDocCommentForClass(String)
ClassSourceFileComposerFactory
. E.g.
sourceComposerFactory.addImplementedInterface(inputType.getQualifiedSourceName());
inputType
- is the JClassType
reflecting the input-type that triggered the generation via
GWT.create(Class)
.logger
- is the TreeLogger
.sourceComposerFactory
- is the ClassSourceFileComposerFactory
.context
- is the GeneratorContext
.protected abstract void generateClassContents(com.google.gwt.core.ext.typeinfo.JClassType inputType, com.google.gwt.core.ext.TreeLogger logger, com.google.gwt.user.rebind.SourceWriter sourceWriter, String simpleName, com.google.gwt.core.ext.GeneratorContext context)
Class
to generate.inputType
- is the JClassType
reflecting the input-type that triggered the generation via
GWT.create(Class)
.logger
- is the TreeLogger
.sourceWriter
- is the SourceWriter
where to write
the source code
to.simpleName
- is the simple name
of the Class
to generate.context
- is the GeneratorContext
.protected String createClassName(com.google.gwt.core.ext.typeinfo.JClassType inputType)
simple name
of the Class
to generate. Typically
derived from JClassType.getName()
of the given inputType
with a static suffix or prefix that is
specific enough to avoid clashing with existing classes.inputType
- is the JClassType
reflecting the input-type that triggered the generation via
GWT.create(Class)
.simple name
of the Class
to generate.protected void generateDefaultConstructor(com.google.gwt.user.rebind.SourceWriter sourceWriter, String simpleName)
sourceWriter
- is the SourceWriter
.simpleName
- is the simple name
.protected final void generateSourcePublicConstructorDeclaration(com.google.gwt.user.rebind.SourceWriter sourceWriter, String methodName)
sourceWriter
- is the SourceWriter
.methodName
- is the name of the method (or the simple class name
for a
constructor}.protected final void generateSourcePublicMethodDeclaration(com.google.gwt.user.rebind.SourceWriter sourceWriter, com.google.gwt.core.ext.typeinfo.JMethod method)
sourceWriter
- is the SourceWriter
.method
- is the JMethod
to implement.protected final void generateSourcePublicMethodDeclaration(com.google.gwt.user.rebind.SourceWriter sourceWriter, String returnType, String methodName, String arguments, boolean override)
sourceWriter
- is the SourceWriter
.returnType
- is the return type of the method.methodName
- is the name of the method (or the simple class name
for a
constructor}.arguments
- is the source line with the arguments to the method or constructor.override
- - true
if an Override
annotation shall be added.protected final void generateSourceCloseBlock(com.google.gwt.user.rebind.SourceWriter sourceWriter)
sourceWriter
- is the SourceWriter
.protected boolean isCachedResultObsolete(com.google.gwt.core.ext.CachedGeneratorResult cachedGeneratorResult, String typeName)
CachedGeneratorResult
is obsolete or can be reused.cachedGeneratorResult
- is the CachedGeneratorResult
.typeName
- is the full-qualified name of the Class
to generate.true
if the CachedGeneratorResult
is obsolete and has to be re-generated, false
otherwise (if it can be reused).Copyright © 2001–2016 mmm-Team. All rights reserved.