|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface GeneratorAdapter
An adapter that performs code generation for a Generator
.
A GeneratorAdapter
implementation performs code generation for a single type of model object. It is
created by a GeneratorAdapterFactory
and used by its containing Generator
. Several different
generator adapters can be associated with a single object, with each one contributing functionality to the code
generation for that object. A singleton pattern is usually used for generator adapters, where a single instance of an
adapter type is shared by all instances of the same object type.
A generator adapter is primarily responsible for two aspects of two tasks. The tasks are:
The two aspects of these tasks are:
In all cases, a project type can be used to identify a subset of the code generation for the given object. This is an arbitrary object that should be meaningful to the particular generator adapter.
See Generator.canGenerate(Object, Object)
and Generator.generate(Object, Object, String, Monitor)
for detailed descriptions of the protocol by which generator adapters are actually used to complete the two tasks.
Generator.canGenerate(Object, Object)
,
Generator.generate(Object, Object, String, Monitor)
Method Summary | |
---|---|
boolean |
canGenerate(java.lang.Object object,
java.lang.Object projectType)
Returns whether code of the given object type can be generated for the specified object. |
void |
dispose()
Removes the adapter from its Notifier s and performs any other needed
disposal. |
Diagnostic |
generate(java.lang.Object object,
java.lang.Object projectType,
Monitor monitor)
Generates code for the given object and project type. |
GeneratorAdapterFactory |
getAdapterFactory()
Returns the adapter factory that created this adapter. |
java.util.Collection<?> |
getCanGenerateChildren(java.lang.Object object,
java.lang.Object projectType)
Returns any children of the specified object that are relevant to determining whether code, of the given project type, can be generated for the specified object. |
java.lang.Object |
getCanGenerateParent(java.lang.Object object,
java.lang.Object projectType)
Returns the parent of the specified object if it is relevant to determining whether code, of the given project type, can be generated for the specified object. |
java.util.Collection<?> |
getGenerateChildren(java.lang.Object object,
java.lang.Object projectType)
Returns any children of the specified object for which code of the given project type may be generated. |
java.lang.Object |
getGenerateParent(java.lang.Object object,
java.lang.Object projectType)
Returns the parent of the specified object if code of the given project type may be generated for it. |
Diagnostic |
postGenerate(java.lang.Object object,
java.lang.Object projectType)
Called after all code is generated for the object and/or any of its parents and/or children, in order to give the adapter a chance to perform cleanup from the code generation. |
Diagnostic |
preGenerate(java.lang.Object object,
java.lang.Object projectType)
Called before any code is generated for the object and/or any of its parents and/or children, in order to give the adapter a chance to perform setup for the code generation. |
void |
setAdapterFactory(GeneratorAdapterFactory adapterFactory)
Sets the adapter factory that created this adapter. |
Method Detail |
---|
GeneratorAdapterFactory getAdapterFactory()
setAdapterFactory(GeneratorAdapterFactory)
void setAdapterFactory(GeneratorAdapterFactory adapterFactory)
getAdapterFactory()
java.util.Collection<?> getCanGenerateChildren(java.lang.Object object, java.lang.Object projectType)
java.lang.Object getCanGenerateParent(java.lang.Object object, java.lang.Object projectType)
boolean canGenerate(java.lang.Object object, java.lang.Object projectType)
java.util.Collection<?> getGenerateChildren(java.lang.Object object, java.lang.Object projectType)
java.lang.Object getGenerateParent(java.lang.Object object, java.lang.Object projectType)
Diagnostic preGenerate(java.lang.Object object, java.lang.Object projectType)
Diagnostic generate(java.lang.Object object, java.lang.Object projectType, Monitor monitor)
Diagnostic postGenerate(java.lang.Object object, java.lang.Object projectType)
void dispose()
Notifier
s and performs any other needed
disposal.
|
Copyright 2001-2006 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |