|
GWT 2.3.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gwt.core.ext.GeneratorContextExtWrapper
public class GeneratorContextExtWrapper
EXPERIMENTAL and subject to change. Do not use this in production code.
A wrapper to access a base GeneratorContext
instance as a
GeneratorContextExt
instance. Methods from the
GeneratorContext
interface are passed through to the baseContext,
while methods from the GeneratorContextExt
interface are given
default stub implementations.
Method Summary | |
---|---|
void |
commit(TreeLogger logger,
java.io.PrintWriter pw)
Commits source generation begun with GeneratorContext.tryCreate(TreeLogger, String, String) . |
void |
commitArtifact(TreeLogger logger,
Artifact<?> artifact)
Add an Artifact to the ArtifactSet
that will be presented to the Linker chain at the end of the
compilation cycle. |
GeneratedResource |
commitResource(TreeLogger logger,
java.io.OutputStream os)
Commits resource generation begun with GeneratorContext.tryCreateResource(TreeLogger, String) . |
com.google.gwt.dev.javac.rebind.CachedRebindResult |
getCachedGeneratorResult()
Get cached result from a previous run of the current generator, if available. |
PropertyOracle |
getPropertyOracle()
Gets the property oracle for the current generator context. |
com.google.gwt.dev.resource.ResourceOracle |
getResourcesOracle()
Returns a resource oracle containing all resources that are mapped into the module's source (or super-source) paths. |
long |
getSourceLastModifiedTime(JClassType sourceType)
Get source last modified time. |
TypeOracle |
getTypeOracle()
Gets the type oracle for the current generator context. |
boolean |
isGeneratorResultCachingEnabled()
Check whether generator result caching is currently enabled. |
boolean |
isProdMode()
Returns true if generators are being run to produce code for a production compile. |
static GeneratorContextExt |
newInstance(GeneratorContext baseContext)
Get a new instance wrapped from a base GeneratorContext
implementation. |
boolean |
reuseTypeFromCacheIfAvailable(java.lang.String typeName)
Mark a type to be reused from the generator result cache. |
java.io.PrintWriter |
tryCreate(TreeLogger logger,
java.lang.String packageName,
java.lang.String simpleName)
Attempts to get a PrintWriter so that the caller can
generate the source code for the named type. |
java.io.OutputStream |
tryCreateResource(TreeLogger logger,
java.lang.String partialPath)
Attempts to get an OutputStream so that the caller can write
file contents into the named file underneath the compilation output
directory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static GeneratorContextExt newInstance(GeneratorContext baseContext)
GeneratorContext
implementation.
public void commit(TreeLogger logger, java.io.PrintWriter pw)
GeneratorContext
GeneratorContext.tryCreate(TreeLogger, String, String)
.
commit
in interface GeneratorContext
public void commitArtifact(TreeLogger logger, Artifact<?> artifact) throws UnableToCompleteException
GeneratorContext
ArtifactSet
that will be presented to the Linker
chain at the end of the
compilation cycle. Custom sub-classes of Artifact can be used to write
cooperating Generator and Linker combinations. This method is semantically
equivalent to calling
ArtifactSet.replace(Artifact)
if an
equivalent Artifact had previously been committed.
commitArtifact
in interface GeneratorContext
logger
- a logger; normally the logger passed into
Generator.generate(TreeLogger, GeneratorContext, String)
or a branch thereofartifact
- the Artifact to provide to the Linker chain.
UnableToCompleteException
public GeneratedResource commitResource(TreeLogger logger, java.io.OutputStream os) throws UnableToCompleteException
GeneratorContext
GeneratorContext.tryCreateResource(TreeLogger, String)
.
commitResource
in interface GeneratorContext
UnableToCompleteException
- if the resource cannot be written to
disk, if the specified stream is unknown, or if the stream has
already been committedpublic com.google.gwt.dev.javac.rebind.CachedRebindResult getCachedGeneratorResult()
GeneratorContextExt
getCachedGeneratorResult
in interface GeneratorContextExt
CachedRebindResult
object,
if one has been provided to the context. Null is returned if there
is no previous result, or if generator result caching is not enabled.public PropertyOracle getPropertyOracle()
GeneratorContext
getPropertyOracle
in interface GeneratorContext
public com.google.gwt.dev.resource.ResourceOracle getResourcesOracle()
GeneratorContext
com.google.gwt.core.client
as a source package, then a resource at
com/google/gwt/core/client/Foo.properties
would be exposed
by this resource oracle.
getResourcesOracle
in interface GeneratorContext
public long getSourceLastModifiedTime(JClassType sourceType)
GeneratorContextExt
TODO(jbrosenberg): Implement in terms of a getVersion method yet to be added to TypeOracle, instead of looking for age of a java source file. This will soon be removed.
getSourceLastModifiedTime
in interface GeneratorContextExt
public TypeOracle getTypeOracle()
GeneratorContext
getTypeOracle
in interface GeneratorContext
public boolean isGeneratorResultCachingEnabled()
GeneratorContextExt
isGeneratorResultCachingEnabled
in interface GeneratorContextExt
public boolean isProdMode()
GeneratorContextExt
isProdMode
in interface GeneratorContextExt
public boolean reuseTypeFromCacheIfAvailable(java.lang.String typeName)
GeneratorContextExt
GeneratorExt.generateIncrementally(com.google.gwt.core.ext.TreeLogger, com.google.gwt.core.ext.GeneratorContextExt, java.lang.String)
, with a result containing
RebindStatus.USE_PARTIAL_CACHED
.
reuseTypeFromCacheIfAvailable
in interface GeneratorContextExt
typeName
- the fully qualified name of a type.
public java.io.PrintWriter tryCreate(TreeLogger logger, java.lang.String packageName, java.lang.String simpleName)
GeneratorContext
PrintWriter
so that the caller can
generate the source code for the named type. If the named types already
exists, null
is returned to indicate that no work needs to
be done. The file is not committed until
GeneratorContext.commit(TreeLogger, PrintWriter)
is called.
tryCreate
in interface GeneratorContext
logger
- a logger; normally the logger passed into
Generator.generate(TreeLogger, GeneratorContext, String)
or a branch thereofpackageName
- the name of the package to which the create type belongssimpleName
- the unqualified source name of the type being generated
null
if the package and class already exists,
otherwise a PrintWriter
is returned.public java.io.OutputStream tryCreateResource(TreeLogger logger, java.lang.String partialPath) throws UnableToCompleteException
GeneratorContext
OutputStream
so that the caller can write
file contents into the named file underneath the compilation output
directory. The file is not committed until
GeneratorContext.commitResource(TreeLogger, OutputStream)
is called.
tryCreateResource
in interface GeneratorContext
logger
- a logger; normally the logger passed into
Generator.generate(TreeLogger, GeneratorContext, String)
or a branch thereofpartialPath
- the name of the file whose contents are to be written;
the name can include subdirectories separated by forward slashes
('/')
OutputStream
into which file contents can be
written, or null
if a resource by that name is
already pending or already exists
UnableToCompleteException
- if the resource could not be initialized
for some reason, such as if the specified partial path is invalid
|
GWT 2.3.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |