Class StandaloneMetaProperty<P>
- java.lang.Object
-
- org.joda.beans.impl.BasicMetaProperty<P>
-
- org.joda.beans.impl.StandaloneMetaProperty<P>
-
- Type Parameters:
P
- the type of the property content
- All Implemented Interfaces:
MetaProperty<P>
public final class StandaloneMetaProperty<P> extends BasicMetaProperty<P>
A meta-property that exists separate from a bean.One use case for this is to handle renamed properties in
SerDeserializer
.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Annotation>
annotations()
Gets the annotations of the property.Class<?>
declaringType()
Get the type that declares the property, represented as aClass
.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 <R> StandaloneMetaProperty<R>
of(String propertyName, MetaBean metaBean, Class<R> clazz)
Creates a non-generified property.static <R> StandaloneMetaProperty<R>
of(String propertyName, MetaBean metaBean, Class<R> clazz, Type type)
Creates a property.Type
propertyGenericType()
Gets the generic types of the property.Class<P>
propertyType()
Get the type of the property represented as aClass
.void
set(Bean bean, 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.-
Methods inherited from class org.joda.beans.impl.BasicMetaProperty
equals, hashCode, name, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.joda.beans.MetaProperty
annotation, annotationOpt, createProperty, getString, getString, put, setString, setString
-
-
-
-
Method Detail
-
of
public static <R> StandaloneMetaProperty<R> of(String propertyName, MetaBean metaBean, Class<R> clazz)
Creates a non-generified property.- Type Parameters:
R
- the property type- Parameters:
propertyName
- the property name, not emptymetaBean
- the meta-bean, which does not have to refer to this property, not nullclazz
- the type of the property, not null- Returns:
- the meta-property, not null
-
of
public static <R> StandaloneMetaProperty<R> of(String propertyName, MetaBean metaBean, Class<R> clazz, Type type)
Creates a property.- Type Parameters:
R
- the property type- Parameters:
propertyName
- the property name, not emptymetaBean
- the meta-bean, which does not have to refer to this property, not nullclazz
- the type of the property, not nulltype
- the type of the property, not null- Returns:
- the meta-property, not null
-
metaBean
public MetaBean metaBean()
Description copied from interface:MetaProperty
Gets the meta-bean which owns this meta-property.Each meta-property is fully owned by a single bean.
- Returns:
- the meta-bean, not null
-
declaringType
public Class<?> declaringType()
Description copied from interface:MetaProperty
Get the type that declares the property, represented as aClass
.This is the type of the bean where the property is declared.
- Returns:
- the type declaring the property, not null
-
propertyType
public Class<P> propertyType()
Description copied from interface:MetaProperty
Get the type of the property represented as aClass
.This is the type of the property. For example, the surname of a person would typically be a
String
.- Returns:
- the type of the property, not null
-
propertyGenericType
public Type propertyGenericType()
Description copied from interface:MetaProperty
Gets the generic types of the property.This provides access to the generic type declared in the source code.
- Returns:
- the full generic type of the property, unmodifiable, not null
-
style
public PropertyStyle style()
Description copied from interface:MetaProperty
Gets the style of the property, such as read-only, read-write or write-only.Rather than testing against specific values, it is strongly recommended to call the helper methods on the returned style.
- Returns:
- the property style, not null
-
annotations
public List<Annotation> annotations()
Description copied from interface:MetaProperty
Gets the annotations of the property.The annotations are queried from the property. This is typically accomplished by querying the annotations of the underlying instance variable however any strategy is permitted. If the implementation does not support annotations, an empty list will be returned.
- Returns:
- the annotations, unmodifiable, not null
-
get
public P get(Bean bean)
Description copied from interface:MetaProperty
Gets the value of the property for the specified bean.For a standard JavaBean, this is equivalent to calling
getFoo()
on the bean. Alternate implementations may perform any logic to obtain the value.- Parameters:
bean
- the bean to query, not null- Returns:
- the value of the property on the specified bean, may be null
-
set
public void set(Bean bean, Object value)
Description copied from interface:MetaProperty
Sets the value of the property on the specified bean.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.- Parameters:
bean
- the bean to update, not nullvalue
- the value to set into the property on the specified bean, may be null
-
-