net.sf.mmm.util.pojo.descriptor.impl
Class PojoDescriptorBuilderImpl

java.lang.Object
  extended by net.sf.mmm.util.component.base.AbstractComponent
      extended by net.sf.mmm.util.component.base.AbstractLoggableComponent
          extended by net.sf.mmm.util.pojo.descriptor.base.AbstractPojoDescriptorBuilder
              extended by net.sf.mmm.util.pojo.descriptor.impl.PojoDescriptorBuilderImpl
All Implemented Interfaces:
PojoDescriptorBuilder

@Singleton
public class PojoDescriptorBuilderImpl
extends AbstractPojoDescriptorBuilder

This is the generic implementation of the PojoDescriptorBuilder interface.

Since:
1.1.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
private  ExtendedPojoDescriptorDependenciesImpl configuration
           
private  PojoFieldIntrospector fieldIntrospector
           
private  PojoMethodIntrospector methodIntrospector
           
 
Constructor Summary
PojoDescriptorBuilderImpl()
          The constructor.
PojoDescriptorBuilderImpl(MapFactory mapFactory)
          The constructor.
 
Method Summary
protected
<P> PojoDescriptorImpl<P>
createDescriptor(GenericType<P> pojoType)
          This method creates the pojo descriptor for the given pojoType.
protected  void doInitialize()
          This method performs the actual initialization.
protected  Collection<PojoPropertyAccessorBuilder<?>> getAccessorBuilders()
          This method gets the accessor-builders used to create the accessors for properties of a POJO.
protected  ExtendedPojoDescriptorDependenciesImpl getDependencies()
          This method gets the ExtendedPojoDescriptorDependenciesImpl.
 PojoDescriptorEnhancer getDescriptorEnhancer()
          This method gets the PojoDescriptorEnhancer to use.
protected  PojoFieldIntrospector getFieldIntrospector()
          This method gets the introspector used to find potential fields for accessing properties of a POJO.
protected  PojoMethodIntrospector getMethodIntrospector()
          This method gets the introspector used to find potential methods for accessing properties of a POJO.
protected  void logDuplicateAccessor(PojoPropertyAccessor accessor, PojoPropertyAccessor duplicate)
          This method is called if the accessor given by duplicate was ignored because it has the same name and mode as the given accessor that is already registered.
protected  boolean registerAccessor(PojoDescriptorImpl<?> descriptor, PojoPropertyAccessor accessor)
          This method registers the given accessor for the given descriptor.
 void setConfiguration(ExtendedPojoDescriptorDependenciesImpl configuration)
          This method sets the ExtendedPojoDescriptorDependenciesImpl.
 void setFieldIntrospector(PojoFieldIntrospector introspector)
          This method sets the field-introspector.
 void setMethodIntrospector(PojoMethodIntrospector introspector)
          This method sets the method-introspector.
 
Methods inherited from class net.sf.mmm.util.pojo.descriptor.base.AbstractPojoDescriptorBuilder
getDescriptor, getDescriptor, getDescriptor, pojo2Map
 
Methods inherited from class net.sf.mmm.util.component.base.AbstractLoggableComponent
getLogger, setLogger
 
Methods inherited from class net.sf.mmm.util.component.base.AbstractComponent
doInitialized, getInitializationState, initialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

configuration

private ExtendedPojoDescriptorDependenciesImpl configuration
See Also:
getDependencies()

methodIntrospector

private PojoMethodIntrospector methodIntrospector
See Also:
getMethodIntrospector()

fieldIntrospector

private PojoFieldIntrospector fieldIntrospector
See Also:
getFieldIntrospector()
Constructor Detail

PojoDescriptorBuilderImpl

public PojoDescriptorBuilderImpl()
The constructor. By default it only introspects methods that are public and NOT static.
ATTENTION:
You need to AbstractComponent.initialize() this component before it can be used.


PojoDescriptorBuilderImpl

public PojoDescriptorBuilderImpl(MapFactory mapFactory)
The constructor. By default it only introspects methods that are public and NOT static.
ATTENTION:
You need to AbstractComponent.initialize() this component before it can be used.

Parameters:
mapFactory - is the factory used to create the descriptor cache.
Method Detail

doInitialize

protected void doInitialize()
This method performs the actual initialization. It is called when AbstractComponent.initialize() is invoked for the first time.
ATTENTION:
When you override this method from a sub-class you need to do a super.AbstractComponent.doInitialize().

Overrides:
doInitialize in class AbstractLoggableComponent

getMethodIntrospector

protected PojoMethodIntrospector getMethodIntrospector()
This method gets the introspector used to find potential methods for accessing properties of a POJO.

Returns:
the introspector to use.

setMethodIntrospector

@Inject
public void setMethodIntrospector(PojoMethodIntrospector introspector)
This method sets the method-introspector.

Parameters:
introspector - the introspector to set.

getFieldIntrospector

protected PojoFieldIntrospector getFieldIntrospector()
This method gets the introspector used to find potential fields for accessing properties of a POJO.

Returns:
the introspector to use.

setFieldIntrospector

@Inject
public void setFieldIntrospector(PojoFieldIntrospector introspector)
This method sets the field-introspector.

Parameters:
introspector - the introspector to set.

getAccessorBuilders

protected Collection<PojoPropertyAccessorBuilder<?>> getAccessorBuilders()
This method gets the accessor-builders used to create the accessors for properties of a POJO.

Returns:
the accessorBuilders.

getDescriptorEnhancer

public PojoDescriptorEnhancer getDescriptorEnhancer()
This method gets the PojoDescriptorEnhancer to use.

Returns:
the PojoDescriptorEnhancer.

getDependencies

protected ExtendedPojoDescriptorDependenciesImpl getDependencies()
This method gets the ExtendedPojoDescriptorDependenciesImpl.

Specified by:
getDependencies in class AbstractPojoDescriptorBuilder
Returns:
the ExtendedPojoDescriptorDependenciesImpl.

setConfiguration

@Inject
public void setConfiguration(ExtendedPojoDescriptorDependenciesImpl configuration)
This method sets the ExtendedPojoDescriptorDependenciesImpl.

Parameters:
configuration - is the ExtendedPojoDescriptorDependenciesImpl .

registerAccessor

protected boolean registerAccessor(PojoDescriptorImpl<?> descriptor,
                                   PojoPropertyAccessor accessor)
This method registers the given accessor for the given descriptor.

Parameters:
descriptor - is the PojoDescriptor.
accessor - is the PojoPropertyAccessor to register.
Returns:
true if the given accessor has been registered or false if it has been ignored (it is a duplicate).

createDescriptor

protected <P> PojoDescriptorImpl<P> createDescriptor(GenericType<P> pojoType)
This method creates the pojo descriptor for the given pojoType.

Specified by:
createDescriptor in class AbstractPojoDescriptorBuilder
Type Parameters:
P - is the templated type of the pojoType.
Parameters:
pojoType - is the GenericType reflecting the Pojo.
Returns:
the descriptor used to get information about the properties of the according Pojo.
See Also:
PojoDescriptorBuilder.getDescriptor(java.lang.Class)

logDuplicateAccessor

protected void logDuplicateAccessor(PojoPropertyAccessor accessor,
                                    PojoPropertyAccessor duplicate)
This method is called if the accessor given by duplicate was ignored because it has the same name and mode as the given accessor that is already registered. This method does nothing. It may be overridden to do some debug logging.

Parameters:
accessor - is the accessor that is already registered.
duplicate - is the duplicate that has been ignored.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.