|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.emf.common.notify.impl.AdapterFactoryImpl org.eclipse.emf.codegen.ecore.genmodel.util.GenModelAdapterFactory org.eclipse.emf.codegen.ecore.genmodel.generator.GenModelGeneratorAdapterFactory
public class GenModelGeneratorAdapterFactory
A generator adapter factory for the GenModel package
.
This implementation creates the adapters that perform default EMF code generation. It can also be subclassed to
create derived adapters that remove from or change the default code generation, or to create separate adapters
that augment the default code generation.
The factory implements a singleton adapter pattern, where one adapter is cached and reused for all objects of a given type.
This implementation also initializes its generator's options based on the GenModel
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.eclipse.emf.codegen.ecore.generator.GeneratorAdapterFactory |
---|
GeneratorAdapterFactory.Descriptor |
Field Summary | |
---|---|
static GeneratorAdapterFactory.Descriptor |
DESCRIPTOR
A descriptor for this adapter factory, which can be used to programatically register
it. |
protected GenBaseGeneratorAdapter |
genClassGeneratorAdapter
|
protected GenBaseGeneratorAdapter |
genEnumGeneratorAdapter
|
protected Generator |
generator
|
protected GenBaseGeneratorAdapter |
genModelGeneratorAdapter
|
protected GenBaseGeneratorAdapter |
genPackageGeneratorAdapter
|
protected static java.lang.String |
MERGE_RULES_PATH_NAME
The default JMerge rules file for EMF. |
Fields inherited from class org.eclipse.emf.codegen.ecore.genmodel.util.GenModelAdapterFactory |
---|
modelPackage, modelSwitch |
Constructor Summary | |
---|---|
GenModelGeneratorAdapterFactory()
|
Method Summary | |
---|---|
Adapter |
adapt(Notifier target,
java.lang.Object type)
Does an adapt(Notifier, Object) ,
substituting this for the given type . |
Adapter |
createGenClassAdapter()
Returns a singleton GenClassGeneratorAdapter . |
Adapter |
createGenEnumAdapter()
Returns a singleton GenEnumGeneratorAdapter . |
Adapter |
createGenModelAdapter()
Returns a singleton GenModelGeneratorAdapter . |
Adapter |
createGenPackageAdapter()
Returns a singleton GenPackageGeneratorAdapter . |
void |
dispose()
Disposes this adapter factory and all of the adapters it has created. |
Generator |
getGenerator()
Returns the Generator associated with this adapter factory. |
protected java.lang.String |
getMergeRulesURI(GenModel genModel)
Returns the URI of the merge rules file for the given GenModel . |
protected java.lang.String[] |
getTemplatePath(GenModel genModel)
Deprecated. org.eclipse.emf.codegen.ecore 2.2.2 Override AbstractGeneratorAdapter.addBaseTemplatePathEntries(java.util.List)
and, if needed, getMergeRulesURI(GenModel) , instead. |
void |
initialize(java.lang.Object input)
Performs initialization for the given input GenModel . |
boolean |
isFactoryForType(java.lang.Object type)
Returns true when the type is GeneratorAdapter.class . |
void |
setGenerator(Generator generator)
Sets the Generator associated with this adapter factory. |
Methods inherited from class org.eclipse.emf.codegen.ecore.genmodel.util.GenModelAdapterFactory |
---|
createAdapter, createEObjectAdapter, createGenAnnotationAdapter, createGenBaseAdapter, createGenClassifierAdapter, createGenDataTypeAdapter, createGenEnumLiteralAdapter, createGenFeatureAdapter, createGenOperationAdapter, createGenParameterAdapter, createGenTypedElementAdapter, createGenTypeParameterAdapter |
Methods inherited from class org.eclipse.emf.common.notify.impl.AdapterFactoryImpl |
---|
adapt, adaptAllNew, adaptNew, associate, createAdapter, resolve |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.eclipse.emf.common.notify.AdapterFactory |
---|
adapt, adaptAllNew, adaptNew |
Field Detail |
---|
public static final GeneratorAdapterFactory.Descriptor DESCRIPTOR
register
it.
GeneratorAdapterFactory.Descriptor.Registry
protected static final java.lang.String MERGE_RULES_PATH_NAME
protected Generator generator
protected GenBaseGeneratorAdapter genModelGeneratorAdapter
protected GenBaseGeneratorAdapter genPackageGeneratorAdapter
protected GenBaseGeneratorAdapter genClassGeneratorAdapter
protected GenBaseGeneratorAdapter genEnumGeneratorAdapter
Constructor Detail |
---|
public GenModelGeneratorAdapterFactory()
Method Detail |
---|
public boolean isFactoryForType(java.lang.Object type)
true
when the type is GeneratorAdapter.class
.
isFactoryForType
in interface AdapterFactory
isFactoryForType
in class GenModelAdapterFactory
type
- the key indicating the type of adapter in question.
Adapter.isAdapterForType(java.lang.Object)
public Adapter adapt(Notifier target, java.lang.Object type)
adapt(Notifier, Object)
,
substituting this
for the given type
. This substitution is necessary because each of many
generator adapter factories can have its own generator adapter on a single object.
adapt
in interface AdapterFactory
adapt
in class AdapterFactoryImpl
target
- the notifier to adapt.type
- the key indicating the type of adapter required.
Adapter.setTarget(org.eclipse.emf.common.notify.Notifier)
,
AdapterFactory.adaptNew(org.eclipse.emf.common.notify.Notifier, java.lang.Object)
public Adapter createGenModelAdapter()
GenModelGeneratorAdapter
.
createGenModelAdapter
in class GenModelAdapterFactory
GenModel
public Adapter createGenPackageAdapter()
GenPackageGeneratorAdapter
.
createGenPackageAdapter
in class GenModelAdapterFactory
GenPackage
public Adapter createGenClassAdapter()
GenClassGeneratorAdapter
.
createGenClassAdapter
in class GenModelAdapterFactory
GenClass
public Adapter createGenEnumAdapter()
GenEnumGeneratorAdapter
.
createGenEnumAdapter
in class GenModelAdapterFactory
GenEnum
public Generator getGenerator()
GeneratorAdapterFactory
Generator
associated with this adapter factory.
getGenerator
in interface GeneratorAdapterFactory
GeneratorAdapterFactory.setGenerator(Generator)
public void setGenerator(Generator generator)
GeneratorAdapterFactory
Generator
associated with this adapter factory.
setGenerator
in interface GeneratorAdapterFactory
GeneratorAdapterFactory.getGenerator()
public void initialize(java.lang.Object input)
GenModel
. It is used as the basis for setting
options
on the associated Generator
.
initialize
in interface GeneratorAdapterFactory
@Deprecated protected java.lang.String[] getTemplatePath(GenModel genModel)
AbstractGeneratorAdapter.addBaseTemplatePathEntries(java.util.List)
and, if needed, getMergeRulesURI(GenModel)
, instead.
GenModel
. The result of this method was intended to be used
in setting the generator's templatePath
option. However, a single path for all code generation is actually insufficient. The path needs to be specified and
extended on a per-adapter basis.
If this implementation is not overridden, the generator's templatePath
will no longer be set to
the default value. Instead, it will be left null, and template paths will be computed on a per-adapter basis using
AbstractGeneratorAdapter.addBaseTemplatePathEntries(java.util.List)
.
In order to preserve backwards compatibility, if this implementation is overridden to return something other
than the default, the generator's templatePath
will be set to this result.
Previously, this path was also searched to obtain the value to set as the generator's
mergeRulesURI
option. Now, if this
method is not overridden, the new getMergeRulesURI(GenModel)
method will be invoked to compute that value.
protected java.lang.String getMergeRulesURI(GenModel genModel)
GenModel
.
The default implementation of this method is to search the default path that would be returned by
getTemplatePath(GenModel)
, if not overridden, for a file called "emf-merge.xml", and return the URI of
the first such file encountered. Since that method has been deprecated, this method can now be overridden to search
a different path, or indeed, obtain the merge rules URI in some other way.
This method is only invoked if getTemplatePath(GenModel)
has not been overridden.
public void dispose()
GeneratorAdapterFactory
dispose
in interface GeneratorAdapterFactory
|
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 |