public static class PropertySupport.Reflection<T> extends Node.Property<T>
FeatureDescriptor.getName() will be set automatically.| Modifier and Type | Field | Description |
|---|---|---|
protected java.lang.Object |
instance |
Instance of a bean.
|
| Constructor | Description |
|---|---|
Reflection(java.lang.Object instance,
java.lang.Class<T> valueType,
java.lang.reflect.Method getter,
java.lang.reflect.Method setter) |
Create a support with method objects specified.
|
Reflection(java.lang.Object instance,
java.lang.Class<T> valueType,
java.lang.String property) |
Create a support based on the property name.
|
Reflection(java.lang.Object instance,
java.lang.Class<T> valueType,
java.lang.String getter,
java.lang.String setter) |
Create a support with methods specified by name.
|
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
canRead() |
Test whether the property is readable.
|
boolean |
canWrite() |
Test whether the property is writable.
|
java.beans.PropertyEditor |
getPropertyEditor() |
Get a property editor for this property.
|
T |
getValue() |
Get the value.
|
void |
setPropertyEditorClass(java.lang.Class<? extends java.beans.PropertyEditor> clazz) |
Set the property editor explicitly.
|
void |
setValue(T val) |
Set the value.
|
attributeNames, getDisplayName, getName, getShortDescription, getValue, isExpert, isHidden, isPreferred, setDisplayName, setExpert, setHidden, setName, setPreferred, setShortDescription, setValue, toStringequals, getHtmlDisplayName, getValueType, hashCode, isDefaultValue, restoreDefaultValue, supportsDefaultValuepublic Reflection(java.lang.Object instance,
java.lang.Class<T> valueType,
java.lang.reflect.Method getter,
java.lang.reflect.Method setter)
instance - (Bean) object to work onvalueType - type of the propertygetter - getter method, can be nullsetter - setter method, can be nulljava.lang.IllegalArgumentException - if the methods are not publicpublic Reflection(java.lang.Object instance,
java.lang.Class<T> valueType,
java.lang.String getter,
java.lang.String setter)
throws java.lang.NoSuchMethodException
instance - (Bean) object to work onvalueType - type of the propertygetter - name of getter method, can be nullsetter - name of setter method, can be nulljava.lang.NoSuchMethodException - if the getter or setter methods cannot be foundpublic Reflection(java.lang.Object instance,
java.lang.Class<T> valueType,
java.lang.String property)
throws java.lang.NoSuchMethodException
get and
set, respectively.instance - object to work onvalueType - type of the propertyproperty - name of propertyjava.lang.NoSuchMethodException - if the getter or setter methods cannot be foundpublic boolean canRead()
Node.PropertycanRead in class Node.Property<T>true if it ispublic T getValue() throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException
Node.PropertygetValue in class Node.Property<T>java.lang.IllegalAccessException - cannot access the called methodjava.lang.reflect.InvocationTargetException - an exception during invocationjava.lang.IllegalArgumentExceptionpublic boolean canWrite()
Node.PropertycanWrite in class Node.Property<T>true if the read of the value is supportedpublic void setValue(T val) throws java.lang.IllegalAccessException, java.lang.IllegalArgumentException, java.lang.reflect.InvocationTargetException
Node.PropertysetValue in class Node.Property<T>val - the new value of the propertyjava.lang.IllegalAccessException - cannot access the called methodjava.lang.IllegalArgumentException - wrong argumentjava.lang.reflect.InvocationTargetException - an exception during invocationpublic java.beans.PropertyEditor getPropertyEditor()
Node.PropertyPropertyEditorManager. If a property
editor is found, its instance is cached using SoftReference.
Caching happens per thread - e.g. it is guaranteed that multiple
threads accessing the editor will get different instance.getPropertyEditor in class Node.Property<T>null if there is no editorpublic void setPropertyEditorClass(java.lang.Class<? extends java.beans.PropertyEditor> clazz)
clazz - class type of the property editorBuilt on April 24 2018. | Portions Copyright 1997-2018 Oracle. All rights reserved.