## org.eclipse.emf.codegen.ecore.generator
Class AbstractGeneratorAdapterFactory

    java.lang.Object
      org.eclipse.emf.common.notify.impl.AdapterFactoryImpl
          org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapterFactory

All Implemented Interfaces:
  GeneratorAdapterFactory, AdapterFactory

    public abstract class AbstractGeneratorAdapterFactory

extends AdapterFactoryImpl
implements GeneratorAdapterFactory

A base `GeneratorAdapterFactory` implementation. Classes that extend this implementation need only implement `createAdapter(Notifier)` and `dispose()`.

An alternate approach to implementing `GeneratorAdapterFactory` is to extend the adapter factory generated for a package. `GeneratorAdapterFactory`'s overrides of `isFactoryForType(Object)` and `adapt(Notifier, Object)` should be duplicated in classes that take such an approach.

Since:
  2.2.0

Nested Class Summary

Nested classes/interfaces inherited from interface org.eclipse.emf.codegen.ecore.generator.GeneratorAdapterFactory
`GeneratorAdapterFactory.Descriptor`

Field Summary
`protected Generator` `generator`

Constructor Summary
`AbstractGeneratorAdapterFactory()`

Method Summary
`Adapter` `adapt(Notifier target, java.lang.Object type)` Does an `adapt(Notifier, Object)`, substituting `this` for the given `type`.
`protected abstract Adapter` `createAdapter(Notifier target)` Override this to create the adapter for a `Notifier`.
`protected Adapter` `createAdapter(Notifier target, java.lang.Object type)` Calls `createAdapter(Notifier)` to create an adapter for the given `Notifier` and sets its `adapter factory` to `this`.
`protected GeneratorAdapter` `createAdapter(java.lang.Object object)` The given object is returned if it is, itself, a `GeneratorAdapter`.
`protected java.lang.Object` `createAdapter(java.lang.Object object, java.lang.Object type)` Calls `createAdapter(Object)` to create an adapter for the given object and sets its `adapter factory` to `this`.
`abstract void` `dispose()` Disposes this adapter factory and all of the adapters it has created.
`Generator` `getGenerator()` Returns the `Generator` associated with this adapter factory.
`void` `initialize(java.lang.Object input)` Performs initialization for the given model-level input object.
`boolean` `isFactoryForType(java.lang.Object type)` Returns `true` when the type is `GeneratorAdapter.class`.
`protected java.lang.Object` `resolve(java.lang.Object object, java.lang.Object type)` There's no general way to check if a non-`Notifier` already has an adapter associated with it, but in cases where there is a way, override this method and do it here.
`void` `setGenerator(Generator generator)` Sets the `Generator` associated with this adapter factory.

Methods inherited from class org.eclipse.emf.common.notify.impl.AdapterFactoryImpl
`adapt, adaptAllNew, adaptNew, associate`

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

### generator

    protected Generator generator

Constructor Detail

### AbstractGeneratorAdapterFactory

    public AbstractGeneratorAdapterFactory()

Method Detail

### isFactoryForType

    public boolean isFactoryForType(java.lang.Object type)

  Returns `true` when the type is `GeneratorAdapter.class`.

  Specified by:
    `isFactoryForType` in interface `AdapterFactory`
  Overrides:
    `isFactoryForType` in class `AdapterFactoryImpl`
  Parameters:
    `type` - the key indicating the type of adapter in question.
  Returns:
    `false`.
  See Also:
    `Adapter.isAdapterForType(java.lang.Object)`

### adapt

    public Adapter adapt(Notifier target,
                         java.lang.Object type)

  Does an `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.

  Specified by:
    `adapt` in interface `AdapterFactory`
  Overrides:
    `adapt` in class `AdapterFactoryImpl`
  Parameters:
    `target` - the notifier to adapt.
    `type` - the key indicating the type of adapter required.
  Returns:
    an associated adapter.
  See Also:
    `Adapter.setTarget(org.eclipse.emf.common.notify.Notifier)`, `AdapterFactory.adaptNew(org.eclipse.emf.common.notify.Notifier, java.lang.Object)`

### createAdapter

    protected Adapter createAdapter(Notifier target,
                                    java.lang.Object type)

  Calls `createAdapter(Notifier)` to create an adapter for the given `Notifier` and sets its `adapter factory` to `this`.

  Overrides:
    `createAdapter` in class `AdapterFactoryImpl`
  Parameters:
    `target` - the notifier to adapt.
    `type` - the key indicating the type of adapter required.
  Returns:
    a new adapter.
  See Also:
    `AdapterFactoryImpl.createAdapter(Notifier)`

### createAdapter

    protected abstract Adapter createAdapter(Notifier target)

  Override this to create the adapter for a `Notifier`. The adapter must implement `GeneratorAdapter`.

  Overrides:
    `createAdapter` in class `AdapterFactoryImpl`
  Parameters:
    `target` - the notifier to adapt.
  Returns:
    a new adapter.
  See Also:
    `AdapterFactoryImpl.createAdapter(Notifier)`

### resolve

    protected java.lang.Object resolve(java.lang.Object object,
                                       java.lang.Object type)

  There's no general way to check if a non-`Notifier` already has an adapter associated with it, but in cases where there is a way, override this method and do it here. This method parallels `adapt(Notifier, Object)` for plain Java objects, and is not usually needed when dealing only with `EObject`s.

  Overrides:
    `resolve` in class `AdapterFactoryImpl`
  Parameters:
    `object` - arbitrary object to adapt.
    `type` - the key indicating the type of adapter required.
  Returns:
    the object itself.
  See Also:
    `AdapterFactoryImpl.adapt(Object,Object)`

### createAdapter

    protected java.lang.Object createAdapter(java.lang.Object object,
                                             java.lang.Object type)

  Calls `createAdapter(Object)` to create an adapter for the given object and sets its `adapter factory` to `this`. This method parallels `createAdapter(Notifier, Object)` for plain Java objects, and is not usually needed when dealing only with `EObject`s.

### createAdapter

    protected GeneratorAdapter createAdapter(java.lang.Object object)

  The given object is returned if it is, itself, a `GeneratorAdapter`. This can be overridden to create an appropriate adapter for a object. It parallels `createAdapter(Notifier)` for plain Java objects, and is and is not usually needed when dealing only with `EObject`s.

### getGenerator

    public Generator getGenerator()

  Description copied from interface: `GeneratorAdapterFactory`
  Returns the `Generator` associated with this adapter factory.

  Specified by:
    `getGenerator` in interface `GeneratorAdapterFactory`
  See Also:
    `GeneratorAdapterFactory.setGenerator(Generator)`

### setGenerator

    public void setGenerator(Generator generator)

  Description copied from interface: `GeneratorAdapterFactory`
  Sets the `Generator` associated with this adapter factory.

  Specified by:
    `setGenerator` in interface `GeneratorAdapterFactory`
  See Also:
    `GeneratorAdapterFactory.getGenerator()`

### initialize

    public void initialize(java.lang.Object input)

  Performs initialization for the given model-level input object. This implementation does nothing; it should be overridden when `options` should be set on the generator, or other initialization is required.

  Specified by:
    `initialize` in interface `GeneratorAdapterFactory`

### dispose

    public abstract void dispose()

  Description copied from interface: `GeneratorAdapterFactory`
  Disposes this adapter factory and all of the adapters it has created.

  Specified by:
    `dispose` in interface `GeneratorAdapterFactory`

Copyright 2001-2006 IBM Corporation and others. All Rights Reserved.