P - the type of the property contentMetaProperty<P>public final class DirectMetaProperty<P> extends BasicMetaProperty<P>
This meta-property uses reflection to find the Field to obtain the annotations.
| Modifier and Type | Method | Description |
|---|---|---|
<A extends java.lang.annotation.Annotation> |
annotation(java.lang.Class<A> annotationClass) |
Gets an annotation from the property.
|
java.util.List<java.lang.annotation.Annotation> |
annotations() |
Gets the annotations of the property.
|
java.lang.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> |
ofDerived(MetaBean metaBean,
java.lang.String propertyName,
java.lang.Class<?> declaringType,
java.lang.Class<P> propertyType) |
Factory to create a derived read-only meta-property avoiding duplicate generics.
|
static <P> DirectMetaProperty<P> |
ofImmutable(MetaBean metaBean,
java.lang.String propertyName,
java.lang.Class<?> declaringType,
java.lang.Class<P> propertyType) |
Factory to create an imutable meta-property avoiding duplicate generics.
|
static <P> DirectMetaProperty<P> |
ofReadOnly(MetaBean metaBean,
java.lang.String propertyName,
java.lang.Class<?> declaringType,
java.lang.Class<P> propertyType) |
Factory to create a read-only meta-property avoiding duplicate generics.
|
static <P> DirectMetaProperty<P> |
ofReadOnlyBuildable(MetaBean metaBean,
java.lang.String propertyName,
java.lang.Class<?> declaringType,
java.lang.Class<P> propertyType) |
Factory to create a buildable read-only meta-property avoiding duplicate generics.
|
static <P> DirectMetaProperty<P> |
ofReadWrite(MetaBean metaBean,
java.lang.String propertyName,
java.lang.Class<?> declaringType,
java.lang.Class<P> propertyType) |
Factory to create a read-write meta-property avoiding duplicate generics.
|
static <P> DirectMetaProperty<P> |
ofWriteOnly(MetaBean metaBean,
java.lang.String propertyName,
java.lang.Class<?> declaringType,
java.lang.Class<P> propertyType) |
Factory to create a write-only meta-property avoiding duplicate generics.
|
java.lang.reflect.Type |
propertyGenericType() |
Gets the generic types of the property.
|
java.lang.Class<P> |
propertyType() |
Get the type of the property represented as a
Class. |
void |
set(Bean bean,
java.lang.Object value) |
Sets the value of the property on the specified bean.
|
PropertyStyle |
style() |
Gets the style of the property, such as read-only, read-write or write-only.
|
equals, hashCode, name, toStringcreateProperty, getString, getString, put, setString, setStringpublic static <P> DirectMetaProperty<P> ofReadWrite(MetaBean metaBean, java.lang.String propertyName, java.lang.Class<?> declaringType, java.lang.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, java.lang.String propertyName, java.lang.Class<?> declaringType, java.lang.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, java.lang.String propertyName, java.lang.Class<?> declaringType, java.lang.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> ofReadOnlyBuildable(MetaBean metaBean, java.lang.String propertyName, java.lang.Class<?> declaringType, java.lang.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> ofDerived(MetaBean metaBean, java.lang.String propertyName, java.lang.Class<?> declaringType, java.lang.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> ofImmutable(MetaBean metaBean, java.lang.String propertyName, java.lang.Class<?> declaringType, java.lang.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()
MetaPropertyEach meta-property is fully owned by a single bean.
public java.lang.Class<?> declaringType()
MetaPropertyClass.
This is the type of the bean where the property is declared.
public java.lang.Class<P> propertyType()
MetaPropertyClass.
This is the type of the property.
For example, the surname of a person would typically be a String.
public java.lang.reflect.Type propertyGenericType()
MetaPropertyThis provides access to the generic type declared in the source code.
public PropertyStyle style()
MetaPropertyRather than testing against specific values, it is strongly recommended to call the helper methods on the returned style.
public <A extends java.lang.annotation.Annotation> A annotation(java.lang.Class<A> annotationClass)
MetaPropertyThe annotations are queried from the property. This is typically accomplished by querying the annotations of the underlying instance variable however any strategy is permitted..
A - the annotation typeannotationClass - the annotation class to find, not nullpublic java.util.List<java.lang.annotation.Annotation> annotations()
MetaPropertyThe annotations are queried from the property. This is typically accomplished by querying the annotations of the underlying instance variable however any strategy is permitted.
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, java.lang.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–2018 Joda.org. All rights reserved.