站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 5.5.1

PropertySupport.Reflection (NetBeans Nodes API) - NetBeans API Javadoc 5.5.1

org.openide.nodes 6.7.31

org.openide.nodes
Class PropertySupport.Reflection

java.lang.Object
  extended by java.beans.FeatureDescriptor
      extended by org.openide.nodes.Node.Property
          extended by org.openide.nodes.PropertySupport.Reflection
Enclosing class:
PropertySupport

public static class PropertySupport.Reflection
extends Node.Property

Support for properties from Java Reflection.


Field Summary
protected  Object instance
          Instance of a bean.
 
Constructor Summary
PropertySupport.Reflection(Object instance, Class valueType, Method getter, Method setter)
          Create a support with method objects specified.
PropertySupport.Reflection(Object instance, Class valueType, String property)
          Create a support based on the property name.
PropertySupport.Reflection(Object instance, Class valueType, String getter, String setter)
          Create a support with methods specified by name.
 
Method Summary
 boolean canRead()
          Test whether the property is readable.
 boolean canWrite()
          Test whether the property is writable.
 PropertyEditor getPropertyEditor()
          Get a property editor for this property.
 Object getValue()
          Get the value.
 void setPropertyEditorClass(Class clazz)
          Set the property editor explicitly.
 void setValue(Object val)
          Set the value.
 
Methods inherited from class org.openide.nodes.Node.Property
equals, getHtmlDisplayName, getValueType, hashCode, isDefaultValue, restoreDefaultValue, supportsDefaultValue
 
Methods inherited from class java.beans.FeatureDescriptor
attributeNames, getDisplayName, getName, getShortDescription, getValue, isExpert, isHidden, isPreferred, setDisplayName, setExpert, setHidden, setName, setPreferred, setShortDescription, setValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

protected Object instance
Instance of a bean.

Constructor Detail

PropertySupport.Reflection

public PropertySupport.Reflection(Object instance,
                                  Class valueType,
                                  Method getter,
                                  Method setter)
Create a support with method objects specified. The methods must be public.

Parameters:
instance - (Bean) object to work on
valueType - type of the property
getter - getter method, can be null
setter - setter method, can be null
Throws:
IllegalArgumentException - if the methods are not public

PropertySupport.Reflection

public PropertySupport.Reflection(Object instance,
                                  Class valueType,
                                  String getter,
                                  String setter)
                           throws NoSuchMethodException
Create a support with methods specified by name. The instance class will be examined for the named methods. But if the instance class is not public, the nearest public superclass will be used instead, so that the getters and setters remain accessible.

Parameters:
instance - (Bean) object to work on
valueType - type of the property
getter - name of getter method, can be null
setter - name of setter method, can be null
Throws:
NoSuchMethodException - if the getter or setter methods cannot be found

PropertySupport.Reflection

public PropertySupport.Reflection(Object instance,
                                  Class valueType,
                                  String property)
                           throws NoSuchMethodException
Create a support based on the property name. The getter and setter methods are constructed by capitalizing the first letter in the name of propety and prefixing it with get and set, respectively.

Parameters:
instance - object to work on
valueType - type of the property
property - name of property
Throws:
NoSuchMethodException - if the getter or setter methods cannot be found
Method Detail

canRead

public boolean canRead()
Description copied from class: Node.Property
Test whether the property is readable.

Specified by:
canRead in class Node.Property
Returns:
true if it is

getValue

public Object getValue()
                throws IllegalAccessException,
                       IllegalArgumentException,
                       InvocationTargetException
Description copied from class: Node.Property
Get the value.

Specified by:
getValue in class Node.Property
Returns:
the value of the property
Throws:
IllegalAccessException - cannot access the called method
InvocationTargetException - an exception during invocation
IllegalArgumentException

canWrite

public boolean canWrite()
Description copied from class: Node.Property
Test whether the property is writable.

Specified by:
canWrite in class Node.Property
Returns:
true if the read of the value is supported

setValue

public void setValue(Object val)
              throws IllegalAccessException,
                     IllegalArgumentException,
                     InvocationTargetException
Description copied from class: Node.Property
Set the value.

Specified by:
setValue in class Node.Property
Parameters:
val - the new value of the property
Throws:
IllegalAccessException - cannot access the called method
IllegalArgumentException - wrong argument
InvocationTargetException - an exception during invocation

getPropertyEditor

public PropertyEditor getPropertyEditor()
Description copied from class: Node.Property
Get a property editor for this property. The default implementation tries to use PropertyEditorManager.

Overrides:
getPropertyEditor in class Node.Property
Returns:
the property editor, or null if there is no editor

setPropertyEditorClass

public void setPropertyEditorClass(Class clazz)
Set the property editor explicitly.

Parameters:
clazz - class type of the property editor

org.openide.nodes 6.7.31

Built on March 26 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.