|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface GeneratorContext
Provides metadata to deferred binding generators.
Method Summary | |
---|---|
void |
commit(TreeLogger logger,
java.io.PrintWriter pw)
Commits source generation begun with tryCreate(TreeLogger, String, String) . |
void |
commitResource(TreeLogger logger,
java.io.OutputStream os)
Commits resource generation begun with tryCreateResource(TreeLogger, String) . |
PropertyOracle |
getPropertyOracle()
Gets the property oracle for the current generator context. |
TypeOracle |
getTypeOracle()
Gets the type oracle for the current generator context. |
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. |
Method Detail |
---|
void commit(TreeLogger logger, java.io.PrintWriter pw)
tryCreate(TreeLogger, String, String)
.
void commitResource(TreeLogger logger, java.io.OutputStream os) throws UnableToCompleteException
tryCreateResource(TreeLogger, String)
.
UnableToCompleteException
- if the resource cannot be written to
disk, if the specified stream is unknown, or if the stream has
already been committedPropertyOracle getPropertyOracle()
TypeOracle getTypeOracle()
java.io.PrintWriter tryCreate(TreeLogger logger, java.lang.String packageName, java.lang.String simpleName)
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
commit(TreeLogger, PrintWriter)
is called.
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.java.io.OutputStream tryCreateResource(TreeLogger logger, java.lang.String partialPath) throws UnableToCompleteException
OutputStream
so that the caller can write
file contents into the named file underneath the compilation output
directory. The file is not committed until
commitResource(TreeLogger, OutputStream)
is called.
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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |