com.google.gwt.resources.ext.ResourceGenerator |
Known Indirect Subclasses |
Encapsulates per-type resource generation logic. This type is used only by
developers who wish to add additional resource types to the resource
generation system. Implementations are paired with one or more interfaces
derived from ResourcePrototype that have been annotated with an
ResourceGeneratorType
annotation. Instances of ResourceGenerator must
support default-instantiation (i.e. via newInstance()
).
The methods on an instance of ResourceGenerator will be called in the following order by the resource generation system:
init(TreeLogger, ResourceContext)
prepare(TreeLogger, ResourceContext, ClientBundleRequirements, JMethod)
once for each methodfinish(TreeLogger, ResourceContext)
.createFields(TreeLogger, ResourceContext, ClientBundleFields)
createAssignment(TreeLogger, ResourceContext, JMethod)
once for each methodfinish(TreeLogger, ResourceContext)
The methods prepare(TreeLogger, ResourceContext, ClientBundleRequirements, JMethod)
and createAssignment(TreeLogger, ResourceContext, JMethod)
will be called
only with those methods whose ResourcePrototype-derived type specifies the
particular type of ResourceGenerator as the implementor. The relative order
in which ResourceGenerators are invoked and the specific order in which the
bundle's methods are presented is undefined.
Direct access to the contents of the generated bundle implementation is intentionally limited to prevent unrelated ResourceGenerators from potentially creating namespace conflicts or generating invalid Java source.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Produce the right-hand-side of a Java assignment expression to provide the
singleton instance object for a particular resource.
| |||||||||||
The ResourceGenerator can create fields within the implementation of the
bundle type.
| |||||||||||
Called at the end of the resource generation phase and can be used to
perform cleanup.
| |||||||||||
Initialize the ResourceGenerator with the generation context that will
remain valid for the duration of the resource-generation phase.
| |||||||||||
Called once for each method the ResourceGenerator is expected to handle.
|
Produce the right-hand-side of a Java assignment expression to provide the singleton instance object for a particular resource.
Example:
new MySampleResource() { public Foo getFoo() { ... } }
UnableToCompleteException |
---|
The ResourceGenerator can create fields within the implementation of the bundle type. The Fields object passed into this method is used to declare, and possibly initialize, Java fields within the final implementation of the resource bundle type.
The Fields instance should not be retained beyond the lifetime of this method as operation on this object is not defined after the implementation of this method returns.
UnableToCompleteException |
---|
Called at the end of the resource generation phase and can be used to perform cleanup.
UnableToCompleteException |
---|
Initialize the ResourceGenerator with the generation context that will remain valid for the duration of the resource-generation phase. The logger instance should not be retained; use the per-method loggers instead.
UnableToCompleteException |
---|
Called once for each method the ResourceGenerator is expected to handle. This allows cross-resource state to be accumulated, such as for data aggregation.
UnableToCompleteException |
---|