P
- the type of the property contentpublic interface MetaProperty<P> extends BeanQuery<P>
Modifier and Type | Method and Description |
---|---|
<A extends Annotation> |
annotation(Class<A> annotation)
Gets a specified annotation of the property.
|
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 . |
boolean |
equals(Object obj)
Checks if this meta-property equals another.
|
P |
get(Bean bean)
Gets the value of the property for the specified bean.
|
String |
getString(Bean bean)
Gets the value of the property for the specified bean converted to a string.
|
String |
getString(Bean bean,
org.joda.convert.StringConvert stringConvert)
Gets the value of the property for the specified bean converted to a string.
|
int |
hashCode()
Returns a suitable hash code.
|
MetaBean |
metaBean()
Gets the meta-bean which owns this meta-property.
|
String |
name()
Gets the property name.
|
Type |
propertyGenericType()
Gets the generic types of the property.
|
Class<P> |
propertyType()
Get the type of the property represented as a
Class . |
P |
put(Bean bean,
Object value)
Sets the value of the property on the associated bean and returns the previous value.
|
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.
|
void |
setString(Bean bean,
String value)
Sets the value of the property on the specified bean from a string by conversion.
|
void |
setString(Bean bean,
String value,
org.joda.convert.StringConvert stringConvert)
Sets the value of the property on the specified bean from a string by conversion.
|
Property<P> createProperty(Bean bean)
bean
- the bean to create the property for, not nullMetaBean metaBean()
Each meta-property is fully owned by a single bean.
String name()
The JavaBean style methods getFoo() and setFoo() will lead to a property name of 'foo' and so on.
Class<?> declaringType()
Class
.Class<P> propertyType()
Class
.Type propertyGenericType()
This provides access to the generic type declared in the source code.
PropertyReadWrite readWrite()
List<Annotation> annotations()
<A extends Annotation> A annotation(Class<A> annotation)
A
- the annotation typeannotation
- the annotation class to find, not nullNoSuchElementException
- if the annotation is not specifiedP get(Bean bean)
For a standard JavaBean, this is equivalent to calling getFoo()
on the bean.
Alternate implementations may perform any logic to obtain the value.
get
in interface BeanQuery<P>
bean
- the bean to query, not nullClassCastException
- if the bean is of an incorrect typeUnsupportedOperationException
- if the property is write-onlyvoid set(Bean bean, Object value)
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 nullClassCastException
- if the bean is of an incorrect typeClassCastException
- if the value is of an invalid type for the propertyUnsupportedOperationException
- if the property is read-onlyRuntimeException
- if the value is rejected by the property (use appropriate subclasses)P put(Bean bean, Object value)
The value must be of the correct type for the property.
This is a combination of the get
and set
methods that matches the definition
of put
in a Map
.
bean
- the bean to update, not nullvalue
- the value to set into the property on the specified bean, may be nullClassCastException
- if the bean is of an incorrect typeClassCastException
- if the value is of an invalid type for the propertyUnsupportedOperationException
- if the property is read-onlyRuntimeException
- if the value is rejected by the property (use appropriate subclasses)String getString(Bean bean)
This converts the result of get(Bean)
to a standard format string.
Conversion uses Joda-Convert.
Not all object types can be converted to a string, see Joda-Convert.
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 nullClassCastException
- if the bean is of an incorrect typeUnsupportedOperationException
- if the property is write-onlyRuntimeException
- if the value cannot be converted to a string (use appropriate subclasses)String getString(Bean bean, org.joda.convert.StringConvert stringConvert)
This converts the result of get(Bean)
to a standard format string using the supplied converter.
Not all object types can be converted to a string, see Joda-Convert.
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 nullstringConvert
- the converter to use, not nullClassCastException
- if the bean is of an incorrect typeUnsupportedOperationException
- if the property is write-onlyRuntimeException
- if the value cannot be converted to a string (use appropriate subclasses)void setString(Bean bean, String value)
This converts the string to the correct type for the property and then sets it
using set(Bean, Object)
. Conversion uses Joda-Convert.
bean
- the bean to update, not nullvalue
- the value to set into the property on the specified bean, may be nullClassCastException
- if the bean is of an incorrect typeClassCastException
- if the value is of an invalid type for the propertyUnsupportedOperationException
- if the property is read-onlyRuntimeException
- if the value is rejected by the property (use appropriate subclasses)void setString(Bean bean, String value, org.joda.convert.StringConvert stringConvert)
This converts the string to the correct type for the property using the supplied converter and then sets it
using set(Bean, Object)
.
bean
- the bean to update, not nullvalue
- the value to set into the property on the specified bean, may be nullstringConvert
- the converter, not nullClassCastException
- if the bean is of an incorrect typeClassCastException
- if the value is of an invalid type for the propertyUnsupportedOperationException
- if the property is read-onlyRuntimeException
- if the value is rejected by the property (use appropriate subclasses)boolean equals(Object obj)
This compares the property name and declaring type. It does not compare the property or bean types.
Copyright © 2007–2013 Joda.org. All rights reserved.