P
- the type of the property contentpublic final class DirectMetaProperty<P> extends BasicMetaProperty<P>
DirectBean
.
This meta-property uses reflection to find the Field
to obtain the annotations.
Modifier and Type | Method and Description |
---|---|
<A extends Annotation> |
annotation(Class<A> annotationClass)
Gets a specified annotation of the property.
|
List<Annotation> |
annotations()
Gets the annotations of the property.
|
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> DirectMetaProperty<P> |
ofReadOnly(MetaBean metaBean,
String propertyName,
Class<?> declaringType,
Class<P> propertyType)
Factory to create a read-write meta-property avoiding duplicate generics.
|
static <P> DirectMetaProperty<P> |
ofReadWrite(MetaBean metaBean,
String propertyName,
Class<?> declaringType,
Class<P> propertyType)
Factory to create a read-write meta-property avoiding duplicate generics.
|
static <P> DirectMetaProperty<P> |
ofWriteOnly(MetaBean metaBean,
String propertyName,
Class<?> declaringType,
Class<P> propertyType)
Factory to create a read-write 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> DirectMetaProperty<P> ofReadWrite(MetaBean metaBean, String propertyName, Class<?> declaringType, Class<P> propertyType)
P
- the property typemetaBean
- the meta-bean, not nullpropertyName
- the property name, not emptydeclaringType
- the type declaring the property, not nullpropertyType
- the property type, not nullpublic static <P> DirectMetaProperty<P> ofReadOnly(MetaBean metaBean, String propertyName, Class<?> declaringType, Class<P> propertyType)
P
- the property typemetaBean
- the meta-bean, not nullpropertyName
- the property name, not emptydeclaringType
- the type declaring the property, not nullpropertyType
- the property type, not nullpublic static <P> DirectMetaProperty<P> ofWriteOnly(MetaBean metaBean, String propertyName, Class<?> declaringType, Class<P> propertyType)
P
- the property typemetaBean
- the meta-bean, not nullpropertyName
- the property name, not emptydeclaringType
- the type declaring the property, not nullpropertyType
- the property type, 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 <A extends Annotation> A annotation(Class<A> annotationClass)
MetaProperty
annotation
in interface MetaProperty<P>
annotation
in class BasicMetaProperty<P>
A
- the annotation typeannotationClass
- the annotation class to find, not nullpublic 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.