gov.nasa.arc.brahms.common.data
Class JavaPropertyDescriptor

java.lang.Object
  extended by gov.nasa.arc.brahms.common.data.JavaPropertyDescriptor
All Implemented Interfaces:
IJavaPropertyDescriptor

public class JavaPropertyDescriptor
extends java.lang.Object
implements IJavaPropertyDescriptor

JavaPropertyDescriptor describes one property that a Java class has available to set and/or get its value.

Version:
$Revision: 1.1 $ $Date: 2009/11/23 18:28:41 $ $Author: rnado $
Author:
Ron van Hoof

Constructor Summary
JavaPropertyDescriptor(java.lang.String name, java.lang.reflect.Field field, java.lang.Class<?> targetClass)
          Constructor, creates a new JavaPropertyDescriptor for a Java property accessible via the specified Field.
JavaPropertyDescriptor(java.lang.String name, java.lang.reflect.Method method, java.lang.Class<?> targetClass)
          Constructor, creates a new JavaPropertyDescriptor for a Java property accessible via the specified Method.
JavaPropertyDescriptor(java.lang.String name, java.beans.PropertyDescriptor descriptor, java.lang.Class<?> targetClass)
          Constructor, creates a new JavaPropertyDescriptor for a Java property accessible via the specified PropertyDescriptor used for a property that follows the standard Java convention by having getFoo and setFoo accessor method.
 
Method Summary
 java.lang.String getName()
          Returns the name of the property.
 java.lang.Class<?> getPropertyType()
          Returns the type of the property.
 IJavaReadAccessor getReadAccessor()
          Returns the accessor used to obtain the property's value.
 IJavaWriteAccessor getWriteAccessor()
          Returns the accessor used to set the property's value.
 boolean isBound()
          Indicates whether the property is a bound property.
 boolean isConstrained()
          Indicates whether the property is a constrained property.
 boolean isReadable()
          Indicates whether the property provides read access.
 boolean isStatic()
          Indicates whether the property is a static/Class property.
 boolean isWritable()
          Indicates whether the property provides write access.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaPropertyDescriptor

public JavaPropertyDescriptor(java.lang.String name,
                              java.beans.PropertyDescriptor descriptor,
                              java.lang.Class<?> targetClass)
Constructor, creates a new JavaPropertyDescriptor for a Java property accessible via the specified PropertyDescriptor used for a property that follows the standard Java convention by having getFoo and setFoo accessor method. Thus if the argument name is "fred", it will assume that the writer method is "setFred" and the reader method is "getFred" (or "isFred" for a boolean property). Note that the property name should start with a lower case character, which will be capitalized in the method names.

Parameters:
name - the programmatic name of the property
descriptor - the PropertyDescriptor used to access the property
targetClass - the Class object for the target object.

JavaPropertyDescriptor

public JavaPropertyDescriptor(java.lang.String name,
                              java.lang.reflect.Method method,
                              java.lang.Class<?> targetClass)
Constructor, creates a new JavaPropertyDescriptor for a Java property accessible via the specified Method. The method allows either only write-access (no return type, single parameter) or only read-access (return type, no parameters).

Parameters:
name - the programmatic name of the property
method - the Method used to access the property
targetClass - the Class object for the target object.

JavaPropertyDescriptor

public JavaPropertyDescriptor(java.lang.String name,
                              java.lang.reflect.Field field,
                              java.lang.Class<?> targetClass)
Constructor, creates a new JavaPropertyDescriptor for a Java property accessible via the specified Field. The field allows direct read/write-access to the property.

Parameters:
name - the programmatic name of the property
field - the Field used to access the property
targetClass - the Class object for the target object.
Method Detail

getName

public java.lang.String getName()
Returns the name of the property.

Specified by:
getName in interface IJavaPropertyDescriptor
Returns:
String the property name

getPropertyType

public java.lang.Class<?> getPropertyType()
Returns the type of the property.

Note that the "Class" object may describe a built-in Java type such as "int". The result may be "null" if this is an indexed property that does not support non-indexed access.

This is the type that will be returned by the ReadAccessor.

Specified by:
getPropertyType in interface IJavaPropertyDescriptor
Returns:
Class the Java type info for the property.

isStatic

public boolean isStatic()
Indicates whether the property is a static/Class property.

Specified by:
isStatic in interface IJavaPropertyDescriptor
Returns:
boolean true if static, false if not

isBound

public boolean isBound()
Indicates whether the property is a bound property. A bound property will cause a PropertyChange event to get fired when the property is changed.

Specified by:
isBound in interface IJavaPropertyDescriptor
Returns:
boolean true if this is a bound property, false otherwise

isConstrained

public boolean isConstrained()
Indicates whether the property is a constrained property. A constrained property will cause a VetoableChange event to get fired when an attempt is made to change the property value.

Specified by:
isConstrained in interface IJavaPropertyDescriptor
Returns:
boolean true if this is a constrained property, false otherwise

isReadable

public boolean isReadable()
Indicates whether the property provides read access.

Specified by:
isReadable in interface IJavaPropertyDescriptor
Returns:
boolean true if readable, false if not

isWritable

public boolean isWritable()
Indicates whether the property provides write access.

Specified by:
isWritable in interface IJavaPropertyDescriptor
Returns:
boolean true if writable, false if not

getReadAccessor

public IJavaReadAccessor getReadAccessor()
Returns the accessor used to obtain the property's value.

Specified by:
getReadAccessor in interface IJavaPropertyDescriptor
Returns:
IReadAccessor the accessor, null if the property's value cannot be read

getWriteAccessor

public IJavaWriteAccessor getWriteAccessor()
Returns the accessor used to set the property's value.

Specified by:
getWriteAccessor in interface IJavaPropertyDescriptor
Returns:
IWriteAccessor the accessor, null if the property's value cannot be written


Copyright © 1997-2012 All Rights Reserved.