|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.mmm.util.pojo.descriptor.base.AbstractPojoDescriptor<POJO>
POJO - is the templated type of the POJO.public abstract class AbstractPojoDescriptor<POJO>
This is the abstract base implementation of the PojoDescriptor
interface.
| Field Summary | |
|---|---|
private GenericType<POJO> |
pojoType
|
| Constructor Summary | |
|---|---|
AbstractPojoDescriptor(GenericType<POJO> pojoType)
The constructor. |
|
| Method Summary | ||
|---|---|---|
Object |
addPropertyItem(POJO pojoInstance,
String propertyName,
Object item)
This method adds the given item to the list-like
property with the given
propertyName from the given pojoInstance using
the
add accessor. |
|
|
getAccessor(String property,
PojoPropertyAccessorMode<ACCESSOR> mode)
This method gets the accessor for the property
with the given propertyName and for the given access
mode. |
|
abstract PojoPropertyDescriptorImpl |
getOrCreatePropertyDescriptor(String propertyName)
This method gets the property-descriptor for the given propertyName. |
|
Class<POJO> |
getPojoClass()
This method gets the type reflecting the Pojo this object is related to. |
|
GenericType<POJO> |
getPojoType()
This method gets the GenericType reflecting the
Pojo this object is related to. |
|
Object |
getProperty(POJO pojoInstance,
String property)
This method gets the property
identified by the given property from the given
pojoInstance. |
|
abstract Collection<? extends AbstractPojoPropertyDescriptor> |
getPropertyDescriptors()
This method gets the descriptors of all
properties of the according pojo. |
|
Object |
getPropertyItem(POJO pojoInstance,
String propertyName,
int index)
This method gets the item with the given index from the
list-like property with the given
propertyName of the given pojoInstance using the
indexed getter
accessor. |
|
int |
getPropertySize(POJO pojoInstance,
String propertyName)
This method gets the size of the property with the given
propertyName from the given pojoInstance. |
|
Boolean |
removePropertyItem(POJO pojoInstance,
String propertyName,
Object item)
This method removes the given item from an array or
Collection using the
remove
property with the given
propertyName from the given pojoInstance
accessor. |
|
Object |
setProperty(POJO pojoInstance,
String propertyName,
Object value)
This method sets the given value for the
property with the given
property of the given pojoInstance. |
|
Object |
setPropertyItem(POJO pojoInstance,
String propertyName,
int index,
Object item)
This method sets the given item at the given
index in the list-like property with the given propertyName of the given
pojoInstance using the
indexed setter
accessor. |
|
String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.sf.mmm.util.pojo.descriptor.api.PojoDescriptor |
|---|
getAccessor, getPropertyDescriptor |
| Field Detail |
|---|
private final GenericType<POJO> pojoType
getPojoType()| Constructor Detail |
|---|
public AbstractPojoDescriptor(GenericType<POJO> pojoType)
pojoType - is the pojo-type.| Method Detail |
|---|
public Class<POJO> getPojoClass()
Pojo this object is related to.
getPojoClass in interface PojoAttributeType<POJO>Pojo.public GenericType<POJO> getPojoType()
GenericType reflecting the
Pojo this object is related to.
getPojoType in interface PojoAttributeType<POJO>Pojo.public abstract Collection<? extends AbstractPojoPropertyDescriptor> getPropertyDescriptors()
descriptors of all
properties of the according pojo.
getPropertyDescriptors in interface PojoDescriptor<POJO>property
descriptorspublic abstract PojoPropertyDescriptorImpl getOrCreatePropertyDescriptor(String propertyName)
propertyName.
propertyName - is the name of the requested property-descriptor.
null if NO
property exists with the given propertyName.
public <ACCESSOR extends PojoPropertyAccessor> ACCESSOR getAccessor(String property,
PojoPropertyAccessorMode<ACCESSOR> mode)
accessor for the property
with the given propertyName and for the given access
mode.
getAccessor in interface PojoDescriptor<POJO>ACCESSOR - is the type of the requested accessor.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.
null if NOT found (there is
no property named propertyName, the property has no
accessor for the given mode, etc.).
public Object getProperty(POJO pojoInstance,
String property)
property
identified by the given property from the given
pojoInstance. The result depends on the form of the given
property as shown by the following table:property |
accessor | example | equivalent |
|---|---|---|---|
[a-zA-Z][a-zA-Z0-9]* |
PojoPropertyAccessorNonArgMode.GET
|
fooBar |
|
[a-zA-Z][a-zA-Z0-9]* "[" [0-9]+ "]" |
PojoPropertyAccessorIndexedNonArgMode.GET_INDEXED
|
fooBar[42] |
|
[a-zA-Z][a-zA-Z0-9]* "['" [a-zA-Z0-9]+ "']" |
PojoPropertyAccessorOneArgMode.GET_MAPPED
|
fooBar['key'] |
|
getProperty in interface PojoDescriptor<POJO>pojoInstance - is the POJO instance where to
access the property.property - identifies the property to get as described above.
type of the
according
getter. Depending on the POJO, the value may be null.
public Object setProperty(POJO pojoInstance,
String propertyName,
Object value)
value for the
property with the given
property of the given pojoInstance. The effect
depends on the form of the given property as shown by the
following table:property |
accessor | example | equivalent |
|---|---|---|---|
[a-zA-Z][a-zA-Z0-9]* |
PojoPropertyAccessorOneArgMode.SET
|
fooBar |
|
[a-zA-Z][a-zA-Z0-9]* "[" [0-9]+ "]" |
PojoPropertyAccessorIndexedOneArgMode.SET_INDEXED
|
fooBar[42] |
|
[a-zA-Z][a-zA-Z0-9]* "['" [a-zA-Z0-9]+ "']" |
PojoPropertyAccessorTwoArgMode.SET_MAPPED
|
fooBar['key'] |
|
setProperty in interface PojoDescriptor<POJO>pojoInstance - is the POJO instance where to
access the property.propertyName - identifies the property to set as explained above.value - is the property value to set. Depending on the POJO the value
may be null.
null if the
return type is void what should be the regular case.
public int getPropertySize(POJO pojoInstance,
String propertyName)
size of the property with the given
propertyName from the given pojoInstance.
getPropertySize in interface PojoDescriptor<POJO>pojoInstance - is the POJO instance where to
access the property.propertyName - is the name of
the property.
public Object addPropertyItem(POJO pojoInstance,
String propertyName,
Object item)
item to the list-like
property with the given
propertyName from the given pojoInstance using
the
add accessor.
addPropertyItem in interface PojoDescriptor<POJO>pojoInstance - is the POJO instance where to
access the property.propertyName - is the name of
the property.item - is the item to add to the property.
null if the
return type is void what should be the regular case.
public Boolean removePropertyItem(POJO pojoInstance,
String propertyName,
Object item)
item from an array or
Collection using the
remove
property with the given
propertyName from the given pojoInstance
accessor.
removePropertyItem in interface PojoDescriptor<POJO>pojoInstance - is the POJO instance where to
access the property.propertyName - is the name of
the property.item - is the item to remove from the property.
Boolean.TRUE if the item has been removed successfully and
Boolean.FALSE if the item was NOT present in the array or
Collection, or null if the accessor is
pointing to a remove method that returns no boolean.
public Object getPropertyItem(POJO pojoInstance,
String propertyName,
int index)
index from the
list-like property with the given
propertyName of the given pojoInstance using the
indexed getter
accessor.
getPropertyItem in interface PojoDescriptor<POJO>pojoInstance - is the POJO instance where to
add the given property item.propertyName - is the name of
the property.index - is the position of the requested item (see
List.get(int)).
null if the
return type is void what should be the regular case.
public Object setPropertyItem(POJO pojoInstance,
String propertyName,
int index,
Object item)
item at the given
index in the list-like property with the given propertyName of the given
pojoInstance using the
indexed setter
accessor.
setPropertyItem in interface PojoDescriptor<POJO>pojoInstance - is the POJO instance where to
access the property.propertyName - is the name of
the property.index - is the position of the item to set (see
List.set(int, Object)).item - is the item to set at the given index.
null if the
return type is void what should be the regular case.public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||