P
- the type of the property contentpublic final class ReflectiveMetaProperty<P> extends BasicMetaProperty<P>
PropertyDescriptor
.
The property descriptor class is part of the JDK JavaBean standard. It provides access to get and set a property on a bean.
Instances of this class should be declared as a static constant on the bean,
one for each property, followed by a ReflectiveMetaBean
declaration.
Modifier and Type | Method and Description |
---|---|
List<Annotation> |
annotations()
Gets the annotations of the property.
|
Property<P> |
createProperty(Bean bean)
Creates a property that binds this meta-property to a specific bean.
|
Class<?> |
declaringType()
Get the type that declares the property, represented as a
Class . |
P |
get(Bean bean)
Gets the value of the property for the specified bean.
|
MetaBean |
metaBean()
Gets the meta-bean which owns this meta-property.
|
static <P> ReflectiveMetaProperty<P> |
of(Class<? extends Bean> beanType,
String propertyName)
Factory to create a meta-property avoiding duplicate generics.
|
Type |
propertyGenericType()
Gets the generic types of the property.
|
Class<P> |
propertyType()
Get the type of the property represented as a
Class . |
PropertyReadWrite |
readWrite()
Gets whether the property is read-only, read-write or write-only.
|
void |
set(Bean bean,
Object value)
Sets the value of the property on the specified bean.
|
public static <P> ReflectiveMetaProperty<P> of(Class<? extends Bean> beanType, String propertyName)
P
- the property typebeanType
- the bean type, not nullpropertyName
- the property name, not emptypublic Property<P> createProperty(Bean bean)
MetaProperty
createProperty
in interface MetaProperty<P>
createProperty
in class BasicMetaProperty<P>
bean
- the bean to create the property for, not nullpublic MetaBean metaBean()
MetaProperty
Each meta-property is fully owned by a single bean.
public Class<?> declaringType()
MetaProperty
Class
.public Class<P> propertyType()
MetaProperty
Class
.public Type propertyGenericType()
MetaProperty
This provides access to the generic type declared in the source code.
public PropertyReadWrite readWrite()
MetaProperty
public List<Annotation> annotations()
MetaProperty
public P get(Bean bean)
MetaProperty
For a standard JavaBean, this is equivalent to calling getFoo()
on the bean.
Alternate implementations may perform any logic to obtain the value.
bean
- the bean to query, not nullpublic void set(Bean bean, Object value)
MetaProperty
The value must be of the correct type for the property.
For a standard JavaBean, this is equivalent to calling setFoo()
on the bean.
Alternate implementations may perform any logic to change the value.
bean
- the bean to update, not nullvalue
- the value to set into the property on the specified bean, may be nullCopyright © 2007–2013 Joda.org. All rights reserved.