net.sf.mmm.util.pojo.descriptor.impl
Class PojoDescriptorImpl<POJO>

java.lang.Object
  extended by net.sf.mmm.util.pojo.descriptor.base.AbstractPojoDescriptor<POJO>
      extended by net.sf.mmm.util.pojo.descriptor.impl.PojoDescriptorImpl<POJO>
Type Parameters:
POJO - is the templated type of the POJO.
All Implemented Interfaces:
PojoAttributeType<POJO>, PojoDescriptor<POJO>

public class PojoDescriptorImpl<POJO>
extends AbstractPojoDescriptor<POJO>

This is the abstract base implementation of the PojoDescriptor interface.

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

Field Summary
private  Collection<PojoPropertyDescriptorImpl> properties
           
private  Map<String,PojoPropertyDescriptorImpl> propertyMap
           
 
Constructor Summary
PojoDescriptorImpl(GenericType<POJO> pojoType)
          The constructor.
 
Method Summary
<ACCESSOR extends PojoPropertyAccessor>
ACCESSOR
getAccessor(String property, PojoPropertyAccessorMode<ACCESSOR> mode, boolean required)
          This method gets the accessor for the given mode from the descriptor with the given propertyName .
 PojoPropertyDescriptorImpl getOrCreatePropertyDescriptor(String propertyName)
          This method gets the property-descriptor for the given propertyName.
 PojoPropertyDescriptorImpl getPropertyDescriptor(String propertyName)
          This method gets the descriptor for the property identified by the given propertyName.
 Collection<PojoPropertyDescriptorImpl> getPropertyDescriptors()
          This method gets the descriptors of all properties of the according pojo.
 
Methods inherited from class net.sf.mmm.util.pojo.descriptor.base.AbstractPojoDescriptor
addPropertyItem, getAccessor, getPojoClass, getPojoType, getProperty, getPropertyItem, getPropertySize, removePropertyItem, setProperty, setPropertyItem, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

propertyMap

private final Map<String,PojoPropertyDescriptorImpl> propertyMap
See Also:
getPropertyDescriptor(String)

properties

private final Collection<PojoPropertyDescriptorImpl> properties
See Also:
getPropertyDescriptor(String)
Constructor Detail

PojoDescriptorImpl

public PojoDescriptorImpl(GenericType<POJO> pojoType)
The constructor.

Parameters:
pojoType - is the pojo-type.
Method Detail

getPropertyDescriptor

public PojoPropertyDescriptorImpl getPropertyDescriptor(String propertyName)
This method gets the descriptor for the property identified by the given propertyName.

Parameters:
propertyName - is the name of the requested property.
Returns:
the descriptor for the property identified by the given propertyName or null if no such property exists for the according pojo.

getPropertyDescriptors

public Collection<PojoPropertyDescriptorImpl> getPropertyDescriptors()
This method gets the descriptors of all properties of the according pojo.

Specified by:
getPropertyDescriptors in interface PojoDescriptor<POJO>
Specified by:
getPropertyDescriptors in class AbstractPojoDescriptor<POJO>
Returns:
a collection with all property descriptors

getAccessor

public <ACCESSOR extends PojoPropertyAccessor> ACCESSOR getAccessor(String property,
                                                                    PojoPropertyAccessorMode<ACCESSOR> mode,
                                                                    boolean required)
This method gets the accessor for the given mode from the descriptor with the given propertyName .

Type Parameters:
ACCESSOR - is the type of the requested accessor.
Parameters:
property - is the name of the property. If the given mode is GET it is treated as for PojoDescriptor.getProperty(Object, String). If the given mode is SET it is treated as for PojoDescriptor.setProperty(Object, String, Object).
mode - is the mode of the requested accessor.
required - - if true the accessor is required and an exception is thrown if NOT found.
Returns:
the requested accessor or null if NOT found and required is false.
See Also:
PojoDescriptor.getPropertyDescriptor(String), PojoPropertyDescriptor.getAccessor(PojoPropertyAccessorMode)

getOrCreatePropertyDescriptor

public PojoPropertyDescriptorImpl getOrCreatePropertyDescriptor(String propertyName)
This method gets the property-descriptor for the given propertyName.

Specified by:
getOrCreatePropertyDescriptor in class AbstractPojoDescriptor<POJO>
Parameters:
propertyName - is the name of the requested property-descriptor.
Returns:
the requested property-descriptor or null if NO property exists with the given propertyName.


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