P
- the type of the property contentpublic abstract class BasicMetaProperty<P> extends Object implements MetaProperty<P>
Modifier | Constructor and Description |
---|---|
protected |
BasicMetaProperty(String propertyName)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
<A extends Annotation> |
annotation(Class<A> annotationClass)
Gets a specified annotation of the property.
|
Property<P> |
createProperty(Bean bean)
Creates a property that binds this meta-property to a specific bean.
|
boolean |
equals(Object obj)
Checks if this meta-property equals another.
|
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.
|
String |
name()
Gets the property name.
|
P |
put(Bean bean,
Object value)
Sets the value of the property on the associated bean and returns the previous value.
|
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.
|
String |
toString()
Returns a string that summarises the meta-property.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
annotations, declaringType, get, metaBean, propertyGenericType, propertyType, readWrite, set
protected BasicMetaProperty(String propertyName)
propertyName
- the property name, not emptypublic Property<P> createProperty(Bean bean)
MetaProperty
createProperty
in interface MetaProperty<P>
bean
- the bean to create the property for, not nullpublic String name()
MetaProperty
The JavaBean style methods getFoo() and setFoo() will lead to a property name of 'foo' and so on.
name
in interface MetaProperty<P>
public P put(Bean bean, Object value)
MetaProperty
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
.
put
in interface MetaProperty<P>
bean
- the bean to update, not nullvalue
- the value to set into the property on the specified bean, may be nullpublic String getString(Bean bean)
MetaProperty
This converts the result of MetaProperty.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.
getString
in interface MetaProperty<P>
bean
- the bean to query, not nullpublic String getString(Bean bean, org.joda.convert.StringConvert stringConvert)
MetaProperty
This converts the result of MetaProperty.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.
getString
in interface MetaProperty<P>
bean
- the bean to query, not nullstringConvert
- the converter to use, not nullpublic void setString(Bean bean, String value)
MetaProperty
This converts the string to the correct type for the property and then sets it
using MetaProperty.set(Bean, Object)
. Conversion uses Joda-Convert.
setString
in interface MetaProperty<P>
bean
- the bean to update, not nullvalue
- the value to set into the property on the specified bean, may be nullpublic void setString(Bean bean, String value, org.joda.convert.StringConvert stringConvert)
MetaProperty
This converts the string to the correct type for the property using the supplied converter and then sets it
using MetaProperty.set(Bean, Object)
.
setString
in interface MetaProperty<P>
bean
- the bean to update, not nullvalue
- the value to set into the property on the specified bean, may be nullstringConvert
- the converter, not nullpublic <A extends Annotation> A annotation(Class<A> annotationClass)
MetaProperty
annotation
in interface MetaProperty<P>
A
- the annotation typeannotationClass
- the annotation class to find, not nullpublic boolean equals(Object obj)
MetaProperty
This compares the property name and declaring type. It does not compare the property or bean types.
equals
in interface MetaProperty<P>
equals
in class Object
obj
- the other meta-property, null returns falsepublic int hashCode()
MetaProperty
hashCode
in interface MetaProperty<P>
hashCode
in class Object
Copyright © 2007–2013 Joda.org. All rights reserved.