public interface PojoUtilLimited
PojoPropertyAccessorBuilder
or even
PojoPathNavigator
. However, within some limitations (a particular
base-class or marker interface is required) this is GWT compatible and therefore abstracts intorspection to
a minimum. Please note that there is no reflection available in GWT context and therefore you will have
limitations. If your custom needs differ from what is offered out of the box, this is the place where to
hook into.Modifier and Type | Method and Description |
---|---|
<V> V |
copy(V value)
This method creates a copy (e.g.
|
List<TypedProperty<?>> |
getProperties(Class<?> pojoType)
|
ValueValidator<?> |
getPropertyValidator(Class<?> pojoType,
String propertyName)
This method gets or creates the
ValueValidator for the specified property derived from
annotations (e.g. |
Object |
getPropertyValue(Object pojo,
String propertyName)
This method gets the value of the specified property.
|
<V> V |
getPropertyValue(Object pojo,
TypedProperty<V> property)
This method gets the value of the specified property.
|
boolean |
isDatatype(Object value)
This method determines if the given object is a (immutable)
Datatype . |
void |
setPropertyValue(Object pojo,
String propertyName,
Object value)
This method sets the value of the specified property.
|
<V> void |
setPropertyValue(Object pojo,
TypedProperty<V> property,
V value)
This method sets the value of the specified property.
|
<V> V copy(V value)
clone
) of the given
value
. If the given value
is immutable (like String
, Long
,
etc.) it is legal to return the same given instance.V
- is the generic type of the value to copy. Typically a
TransferObject
or a
Datatype
.value
- is the value to copy.boolean isDatatype(Object value)
Datatype
. It
will return true
if the given value
is a String
, Boolean
,
Character
, anything derived from Number
, an Enum
, an instance of
Datatype
, a Date
(even though not immutable) or
anything similar should be considered as datatype due to a custom extension.value
- is the object to check.true
if the given value is a (immutable) Datatype
,
false
otherwise.List<TypedProperty<?>> getProperties(Class<?> pojoType)
pojoType
- is the class reflecting the Pojo
.List
with the properties
of the given pojoType
.PojoDescriptor.getPropertyDescriptors()
,
PojoDescriptorBuilderFactory
ValueValidator<?> getPropertyValidator(Class<?> pojoType, String propertyName)
ValueValidator
for the specified property derived from
annotations (e.g. JSR 303 or JSR 308). javax.validation
) nor is it strictly compatible to
it. Instead this is an abstraction that may be implemented using JSR 303 or maybe not. However, we want
to be GWT compatible and we want to directly bind the validation to the UI widgets (see
UiWidgetWithValue#addValidator(ValueValidator)
). The API of JSR 303 is unfortunately biased.
A simple bridge to JSR 303 can be achieved via
javax.validation.Validator.validateProperty(Object, String, Class)
.pojoType
- is the class reflecting the Pojo
owning the property.propertyName
- is the
name
of the
property.ValueValidator
for the given property.Object getPropertyValue(Object pojo, String propertyName)
getPropertyValue(pojo, "foo")
should return pojo.getFoo()
. <V> V getPropertyValue(Object pojo, TypedProperty<V> property)
V
- is the generic type of the requested property value.pojo
- is the Pojo
owning the property.property
- is the TypedProperty
identifying the property to get.getPropertyValue(Object, String)
void setPropertyValue(Object pojo, String propertyName, Object value)
setPropertyValue(pojo, "foo", value)
should have the same effect as
pojo.setFoo(value)
. <V> void setPropertyValue(Object pojo, TypedProperty<V> property, V value)
V
- is the generic type of the property value to set.pojo
- is the Pojo
owning the property.property
- is the TypedProperty
identifying the property to set.value
- is the new property value to set.setPropertyValue(Object, String, Object)
Copyright © 2001–2014 mmm-Team. All rights reserved.