P - the type of the property contentpublic final class BasicProperty<P> extends Object implements Property<P>
Bean to a MetaProperty.
This is the standard implementation of a property. It defers the strategy of getting and setting the value to the meta-property.
This implementation is also a map entry to aid performance in maps.
| Type | Property and Description |
|---|---|
MetaProperty<P> |
meta
Gets the meta-property representing the parts of the property that are
common across all instances, such as the name.
|
| Modifier and Type | Method and Description |
|---|---|
<B extends Bean> |
bean()
Gets the bean which owns this property.
|
boolean |
equals(Object obj)
Checks if this property equals another.
|
P |
get()
Gets the value of the property for the associated bean.
|
int |
hashCode()
Returns a suitable hash code.
|
MetaProperty<P> |
metaProperty()
Gets the meta-property representing the parts of the property that are
common across all instances, such as the name.
|
String |
name()
Gets the property name.
|
static <P> BasicProperty<P> |
of(Bean bean,
MetaProperty<P> metaProperty)
Factory to create a property avoiding duplicate generics.
|
P |
put(Object value)
Sets the value of the property on the associated bean and returns the previous value.
|
void |
set(Object value)
Sets the value of the property on the associated bean.
|
String |
toString()
Returns a string that summarises the property.
|
metaProperty in interface Property<P>public static <P> BasicProperty<P> of(Bean bean, MetaProperty<P> metaProperty)
P - the property typebean - the bean that the property is bound to, not nullmetaProperty - the meta property, not nullpublic <B extends Bean> B bean()
PropertyEach property is fully owned by a single bean.
public MetaProperty<P> metaProperty()
PropertymetaProperty in interface Property<P>public String name()
PropertyThe JavaBean style methods getFoo() and setFoo() will lead to a property name of 'foo' and so on.
public P get()
Property
For a JavaBean, this is the equivalent to calling getFoo() on the bean itself.
Alternate implementations may perform any logic to obtain the value.
public void set(Object value)
Property
The value must be of the correct type for the property.
See the meta-property for string conversion.
For a standard JavaBean, this is equivalent to calling setFoo() on the bean.
Alternate implementations may perform any logic to change the value.
public P put(Object value)
Property
This is a combination of the get and set methods that matches the definition
of put in a Map.
public boolean equals(Object obj)
PropertyThis compares the meta-property and value. It does not consider the property or bean types.
public int hashCode()
PropertyCopyright © 2007–2013 Joda.org. All rights reserved.