Package org.eclipse.net4j.util.factory

# Class AnnotationFactory<PRODUCT>

java.lang.Object
org.eclipse.net4j.util.factory.Factory
org.eclipse.net4j.util.factory.TreeFactory
org.eclipse.net4j.util.factory.TreeFactory.ContainerAware
org.eclipse.net4j.util.factory.AnnotationFactory<PRODUCT>

All Implemented Interfaces:
  `IManagedContainer.ContainerAware`, `IManagedContainerProvider`, `IFactory`, `IFactoryKeyAware`, `ITreeFactory`

public class AnnotationFactory<PRODUCT> extends TreeFactory.ContainerAware
Creates products reflectively and configures them via product method annotations.

Since:
  3.23
Author:
  Eike Stepper

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static @interface`
`AnnotationFactory.InjectAttribute`
`static @interface`
`AnnotationFactory.InjectConfig`
`static @interface`
`AnnotationFactory.InjectContainer`
`static @interface`
`AnnotationFactory.InjectElement`

## Nested classes/interfaces inherited from class org.eclipse.net4j.util.factory.TreeFactory

`TreeFactory.ContainerAware`

## Field Summary

### Fields inherited from class org.eclipse.net4j.util.factory.Factory

`NO_DESCRIPTION`

## Constructor Summary

Constructors
Constructor
Description
`AnnotationFactory(Class<PRODUCT> productType, String productGroup, String type)`
`AnnotationFactory(Class<PRODUCT> productType, IFactoryKey key)`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`configureProduct(PRODUCT product, Tree config)`
`protected final PRODUCT`
`create(Tree config)`
`protected Object`
`createElement(String productGroup, String type, String descriptionAttribute, Tree elementConfig, boolean singleton)`
`protected PRODUCT`
`createProduct(Tree config)`
`protected String`
`getElementType(Tree elementConfig, String factoryTypeAttribute, String defaultFactoryType)`
Deprecated.
As of 3.29, use `getElementType(Tree, String, String, String, String)`.
`protected String`
`getElementType(Tree elementConfig, String factoryTypeAttribute, String defaultFactoryType, String factoryTypePrefix, String factoryTypeSuffix)`
`final Class<PRODUCT>`
`getProductType()`
`protected void`
`injectAttribute(PRODUCT product, Tree config, Method method)`
`protected void`
`injectElement(PRODUCT product, Tree config, Method method)`
`protected boolean`
`isEnumCaseSensitive()`

### Methods inherited from class org.eclipse.net4j.util.factory.TreeFactory.ContainerAware

`getContainer, setManagedContainer`

### Methods inherited from class org.eclipse.net4j.util.factory.TreeFactory

`create, createDescription, createWithTree, getTreeFor, parseTree, productCreationException, productCreationException, xmlDeserialize, xmlSerialize`

### Methods inherited from class org.eclipse.net4j.util.factory.Factory

`getDescriptionFor, getFactoryKey, getKey, getProductGroup, getType, productCreationException, productCreationException, setFactoryKey, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.eclipse.net4j.util.factory.IFactory

`getDescriptionFor, getKey`

## Constructor Details

### AnnotationFactory

public AnnotationFactory(Class<PRODUCT> productType, IFactoryKey key)

### AnnotationFactory

public AnnotationFactory(Class<PRODUCT> productType, String productGroup, String type)

## Method Details

### getProductType

public final Class<PRODUCT> getProductType()

### create

protected final PRODUCT create(Tree config) throws ProductCreationException

Specified by:
  `create` in class `TreeFactory`
Throws:
  `ProductCreationException`

### createProduct

protected PRODUCT createProduct(Tree config) throws Exception

Throws:
  `Exception`

### configureProduct

protected void configureProduct(PRODUCT product, Tree config) throws Exception

Throws:
  `Exception`

### injectAttribute

protected void injectAttribute(PRODUCT product, Tree config, Method method) throws Exception

Throws:
  `Exception`

### isEnumCaseSensitive

protected boolean isEnumCaseSensitive()

### injectElement

protected void injectElement(PRODUCT product, Tree config, Method method) throws IllegalAccessException, InvocationTargetException

Throws:
  `IllegalAccessException`
  `InvocationTargetException`

### getElementType

@Deprecated protected String getElementType(Tree elementConfig, String factoryTypeAttribute, String defaultFactoryType)
Deprecated.
As of 3.29, use `getElementType(Tree, String, String, String, String)`.

### getElementType

protected String getElementType(Tree elementConfig, String factoryTypeAttribute, String defaultFactoryType, String factoryTypePrefix, String factoryTypeSuffix)

Since:
  3.29

### createElement

protected Object createElement(String productGroup, String type, String descriptionAttribute, Tree elementConfig, boolean singleton) throws ProductCreationException

Throws:
  `ProductCreationException`