|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
P - the type of the property contentpublic interface MetaProperty<P>
A meta-property, defining those aspects of a property which are not specific to a particular bean, such as the property type and name.
| Method Summary | ||
|---|---|---|
|
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. |
|
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. |
|
PropertyStyle |
style()
Gets the style of the property, such as read-only, read-write or write-only. |
|
| Method Detail |
|---|
Property<P> createProperty(Bean bean)
bean - the bean to create the property for, not null
MetaBean 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.
PropertyStyle style()
List<Annotation> annotations()
<A extends Annotation> A annotation(Class<A> annotation)
A - the annotation typeannotation - the annotation class to find, not null
NoSuchElementException - 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 null
ClassCastException - if the bean is of an incorrect type
UnsupportedOperationException - if the property is write-only
void 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 null
ClassCastException - if the bean is of an incorrect type
ClassCastException - if the value is of an invalid type for the property
UnsupportedOperationException - if the property is read-only
RuntimeException - 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 null
ClassCastException - if the bean is of an incorrect type
ClassCastException - if the value is of an invalid type for the property
UnsupportedOperationException - if the property is read-only
RuntimeException - 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 null
ClassCastException - if the bean is of an incorrect type
UnsupportedOperationException - if the property is write-only
RuntimeException - 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 null
ClassCastException - if the bean is of an incorrect type
UnsupportedOperationException - if the property is write-only
RuntimeException - 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 null
ClassCastException - if the bean is of an incorrect type
ClassCastException - if the value is of an invalid type for the property
UnsupportedOperationException - if the property is read-only
RuntimeException - 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 null
ClassCastException - if the bean is of an incorrect type
ClassCastException - if the value is of an invalid type for the property
UnsupportedOperationException - if the property is read-only
RuntimeException - 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.
equals in class Objectobj - the other meta-property, null returns false
int hashCode()
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||