org.slim3.container
Class BeanMetaFactory

java.lang.Object
  extended by org.slim3.container.BeanMetaFactory
All Implemented Interfaces:
Disposable

public class BeanMetaFactory
extends Object
implements Disposable

A factory class for the bean meta data.

Version:
3.0
Author:
higa

Field Summary
static String BEAN_META_FACTORY_KEY
          The key for bean meta data factory class.
protected  ConcurrentHashMap<String,BeanMeta> beanMetaCache
          The cache for bean meta data.
static String BINDING_PREFIX
          The prefix for binding.
static String DEFAULT_TRANSACTION_KEY
          The key for bean meta data factory class.
protected  ConcurrentHashMap<String,Interceptor[]> defaultInterceptorsCache
          The cache for array of default interceptors.
protected static TransactionAttributeType defaultTransactionType
          The default transaction attribute.
protected  boolean disposableRegistered
          Whether the disposable is registered.
protected static BeanMetaFactory instance
          The instance.
static String INTERCEPTORS_PREFIX
          The prefix for interceptors.
protected static Map<TransactionAttributeType,Class<?>> txInterceptorClassMap
          The map for interceptor class.
 
Constructor Summary
BeanMetaFactory()
          Constructor.
 
Method Summary
protected  BeanMeta createBeanMeta(Class<?> beanClass)
          Creates a bean meta data.
 void dispose()
          Disposes resource.
 BeanMeta getBeanMeta(Class<?> beanClass)
          Returns the bean meta data.
static BeanMetaFactory getInstance()
          Returns the instance.
protected static void initialize()
          Initializes this class.
protected  void inspectBean(BeanMeta beanMeta)
          Inspects the bean.
protected  Interceptor[] inspectClassInterceptors(Class<?> beanClass)
          Inspects class interceptors.
protected  Interceptor[] inspectConfigurationInterceptors(String key)
          Inspects interceptors from configuration.
protected  Interceptor[] inspectDefaultInterceptors(Class<?> beanClass)
          Inspects default interceptors.
protected  void inspectField(BeanMeta beanMeta, BeanDesc beanDesc, Field field)
          Inspects the field.
protected  void inspectMethod(Class<?> beanClass, Method method, Interceptor[] defaultInterceptors, Interceptor[] classInterceptors, Map<Method,Interceptor[]> interceptorsMap)
          Inspects the method.
 void registerDisposable()
          Registers disposable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BEAN_META_FACTORY_KEY

public static final String BEAN_META_FACTORY_KEY
The key for bean meta data factory class.

See Also:
Constant Field Values

DEFAULT_TRANSACTION_KEY

public static final String DEFAULT_TRANSACTION_KEY
The key for bean meta data factory class.

See Also:
Constant Field Values

BINDING_PREFIX

public static final String BINDING_PREFIX
The prefix for binding.

See Also:
Constant Field Values

INTERCEPTORS_PREFIX

public static final String INTERCEPTORS_PREFIX
The prefix for interceptors.

See Also:
Constant Field Values

instance

protected static BeanMetaFactory instance
The instance.


defaultTransactionType

protected static TransactionAttributeType defaultTransactionType
The default transaction attribute.


txInterceptorClassMap

protected static Map<TransactionAttributeType,Class<?>> txInterceptorClassMap
The map for interceptor class.


disposableRegistered

protected boolean disposableRegistered
Whether the disposable is registered.


beanMetaCache

protected ConcurrentHashMap<String,BeanMeta> beanMetaCache
The cache for bean meta data.


defaultInterceptorsCache

protected ConcurrentHashMap<String,Interceptor[]> defaultInterceptorsCache
The cache for array of default interceptors.

Constructor Detail

BeanMetaFactory

public BeanMetaFactory()
Constructor.

Method Detail

initialize

protected static void initialize()
Initializes this class.


getInstance

public static BeanMetaFactory getInstance()
Returns the instance.

Returns:
the instance

registerDisposable

public void registerDisposable()
Registers disposable.


dispose

public void dispose()
Description copied from interface: Disposable
Disposes resource.

Specified by:
dispose in interface Disposable

getBeanMeta

public BeanMeta getBeanMeta(Class<?> beanClass)
                     throws NullPointerException
Returns the bean meta data.

Parameters:
beanClass - the bean class
Returns:
the bean meta data
Throws:
NullPointerException - if the beanClass parameter is null

createBeanMeta

protected BeanMeta createBeanMeta(Class<?> beanClass)
Creates a bean meta data.

Parameters:
beanClass - the bean class
Returns:
a bean meta data

inspectBean

protected void inspectBean(BeanMeta beanMeta)
Inspects the bean.

Parameters:
beanMeta - the bean meta data

inspectField

protected void inspectField(BeanMeta beanMeta,
                            BeanDesc beanDesc,
                            Field field)
Inspects the field.

Parameters:
beanMeta - the bean meta data
beanDesc - the bean descriptor
field - the field

inspectDefaultInterceptors

protected Interceptor[] inspectDefaultInterceptors(Class<?> beanClass)
Inspects default interceptors.

Parameters:
beanClass - the bean class
Returns:
the intercepors

inspectConfigurationInterceptors

protected Interceptor[] inspectConfigurationInterceptors(String key)
Inspects interceptors from configuration.

Parameters:
key - the key for interceptors
Returns:
the intercepors

inspectClassInterceptors

protected Interceptor[] inspectClassInterceptors(Class<?> beanClass)
Inspects class interceptors.

Parameters:
beanClass - the bean class
Returns:
the class intercepors

inspectMethod

protected void inspectMethod(Class<?> beanClass,
                             Method method,
                             Interceptor[] defaultInterceptors,
                             Interceptor[] classInterceptors,
                             Map<Method,Interceptor[]> interceptorsMap)
Inspects the method.

Parameters:
beanClass - the bean class
method - the around invoke method
defaultInterceptors - the default interceptors
classInterceptors - the class interceptors
interceptorsMap - the map for interceptors


Copyright © 2008-2009 The Slim3 project. All Rights Reserved.