public abstract class IncrementalGenerator extends Generator
Generator
class which supports incremental
generation. It adds a generateIncrementally(com.google.gwt.core.ext.TreeLogger, com.google.gwt.core.ext.GeneratorContext, java.lang.String)
method.Constructor and Description |
---|
IncrementalGenerator() |
Modifier and Type | Method and Description |
---|---|
String |
generate(TreeLogger logger,
GeneratorContext context,
String typeName)
This method overrides
Generator.generate(com.google.gwt.core.ext.TreeLogger, com.google.gwt.core.ext.GeneratorContext, java.lang.String) , and is included only for
backwards compatibility. |
abstract RebindResult |
generateIncrementally(TreeLogger logger,
GeneratorContext context,
String typeName)
Incrementally generate a default constructible subclass of the requested
type.
|
static RebindResult |
generateNonIncrementally(TreeLogger logger,
Generator generator,
GeneratorContext context,
String typeName)
A static helper method to wrap a non-incremental generator's result.
|
abstract long |
getVersionId()
Returns a version id for an IncrementalGenerator.
|
escape, escapeClassName
public static RebindResult generateNonIncrementally(TreeLogger logger, Generator generator, GeneratorContext context, String typeName) throws UnableToCompleteException
Generator.generate(com.google.gwt.core.ext.TreeLogger, com.google.gwt.core.ext.GeneratorContext, java.lang.String)
method, and synthesizes a
RebindResult
instance to be returned.logger
- A TreeLoggergenerator
- A non-incremental generatorcontext
- The generator contexttypeName
- The type for which a subclass will be generatedUnableToCompleteException
public final String generate(TreeLogger logger, GeneratorContext context, String typeName) throws UnableToCompleteException
Generator.generate(com.google.gwt.core.ext.TreeLogger, com.google.gwt.core.ext.GeneratorContext, java.lang.String)
, and is included only for
backwards compatibility. It wraps a call to generateIncrementally(com.google.gwt.core.ext.TreeLogger, com.google.gwt.core.ext.GeneratorContext, java.lang.String)
.
This method won't normally be called by the gwt rebind process, and it is
declared final and can't be overridden. It is provided in support of
existing applications and other generators which call this method directly,
outside of the gwt framework.
The passed in context is wrapped with an instance of
NonIncrementalGeneratorContext
, to ensure that no generator result
caching is attempted, since the cached result will be ignored by callers of
this method anyway.
generate
in class Generator
logger
- A TreeLoggercontext
- The generator contexttypeName
- The type for which a subclass will be generatednull
to cause the requested type itself to be
usedUnableToCompleteException
Generator.generate(com.google.gwt.core.ext.TreeLogger, com.google.gwt.core.ext.GeneratorContext, java.lang.String)
public abstract RebindResult generateIncrementally(TreeLogger logger, GeneratorContext context, String typeName) throws UnableToCompleteException
It returns a RebindResult
, which contains a RebindMode
field, which indicates whether to use previously cached output, newly
generated output, or a partial mixture of both cached and newly generated
output.
The result also includes a field for the name of the subclass to substitute for the requested class. It may also contain extra client data added by specific generator implementations.
This method throws an UnableToCompleteException
if for any
reason it cannot complete successfully.
logger
- A TreeLoggercontext
- The generator contexttypeName
- The type for which a subclass will be generatedUnableToCompleteException
RebindResult
,
RebindMode
public abstract long getVersionId()
CachedGeneratorResult
's that were generated by a
different version of this generator. This is useful when new versions of a
generator are developed, which might alter the structure of generated
output, or alter semantics for cache reusability checking.
It is the responsibility of the developer to maintain this version id consistently.
Copyright © 2018. All rights reserved.