public final class PropertyReference<T>
extends java.lang.Object
Bean.| Modifier and Type | Field and Description |
|---|---|
private java.lang.Class<?> |
clazz |
private java.lang.reflect.Method |
getter |
private java.lang.String |
name |
private java.lang.reflect.Method |
propertyGetter |
private boolean |
reflected |
private java.lang.reflect.Method |
setter |
private java.lang.Class<?> |
type |
| Constructor and Description |
|---|
PropertyReference(java.lang.Class<?> clazz,
java.lang.String name)
Creates a new
PropertyReference for a property of a bean. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
T |
get(java.lang.Object bean)
Get the value of the property.
|
java.lang.Class<?> |
getContainingClass()
Returns the class of the
Bean that contains the property. |
java.lang.String |
getName()
Returns the name of the property.
|
ReadOnlyProperty<T> |
getProperty(java.lang.Object bean)
Get the
ObservableValue implementation of the
property. |
java.lang.Class<?> |
getType()
Returns the type of the property.
|
int |
hashCode() |
boolean |
hasProperty()
Can be used to determine if a property provides an implementation of
ObservableValue. |
boolean |
isReadable()
Can be used to determine if a property can be get.
|
boolean |
isWritable()
Can be used to determine if a property can be set.
|
private void |
reflect() |
void |
set(java.lang.Object bean,
T value)
Set the property to a new value.
|
java.lang.String |
toString() |
private java.lang.String name
private java.lang.reflect.Method getter
private java.lang.reflect.Method setter
private java.lang.reflect.Method propertyGetter
private java.lang.Class<?> clazz
private java.lang.Class<?> type
private boolean reflected
public PropertyReference(java.lang.Class<?> clazz,
java.lang.String name)
PropertyReference for a property of a bean.clazz - The class of the Bean that contains the propertyname - The name of the propertyjava.lang.NullPointerException - if clazz or name are nulljava.lang.IllegalArgumentException - if name is an empty Stringpublic boolean isWritable()
true, if the property can be set, false otherwisepublic boolean isReadable()
true, if the property can be get, false otherwisepublic boolean hasProperty()
ObservableValue.public java.lang.String getName()
public java.lang.Class<?> getContainingClass()
Bean that contains the property.Beanpublic java.lang.Class<?> getType()
public void set(java.lang.Object bean,
T value)
bean - The Bean instance for which the property should be setvalue - The new valuejava.lang.IllegalStateException - if the property is not writablepublic T get(java.lang.Object bean)
bean - The Bean instance for which the property should be
readjava.lang.IllegalStateException - if the property is not readablepublic ReadOnlyProperty<T> getProperty(java.lang.Object bean)
ObservableValue implementation of the
property.bean - The Bean instance for which the property should be
readObservableValue of the propertyjava.lang.IllegalStateException - if the property does not provide an implementationpublic java.lang.String toString()
toString in class java.lang.Objectprivate void reflect()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object