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

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

public class JavaDescriptorReadAccessor
extends java.lang.Object
implements IJavaReadAccessor

JavaDescriptorReadAccessor provides read access for a property's value through a Java PropertyDescriptor's read method.

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

Constructor Summary
JavaDescriptorReadAccessor(java.beans.PropertyDescriptor descriptor, IJavaPropertyDescriptor property)
          Constructor, creates JavaDescriptorReadAccessor that reads the property value for the specified property using the specified PropertyDescriptor's read method.
 
Method Summary
 java.lang.Object get(java.lang.Object obj)
          Returns the value of the property represented by the IJavaPropertyDescriptor, on the specified object.
 boolean getBoolean(java.lang.Object obj)
          Gets the value of a static or instance boolean property.
 byte getByte(java.lang.Object obj)
          Gets the value of a static or instance byte property.
 char getChar(java.lang.Object obj)
          Gets the value of a static or instance property of type char or of another primitive type convertible to type char via a widening conversion.
 double getDouble(java.lang.Object obj)
          Gets the value of a static or instance property of type double or of another primitive type convertible to type double via a widening conversion.
 float getFloat(java.lang.Object obj)
          Gets the value of a static or instance property of type float or of another primitive type convertible to type float via a widening conversion.
 int getInt(java.lang.Object obj)
          Gets the value of a static or instance property of type int or of another primitive type convertible to type int via a widening conversion.
 long getLong(java.lang.Object obj)
          Gets the value of a static or instance property of type long or of another primitive type convertible to type long via a widening conversion.
 IJavaPropertyDescriptor getPropertyDescriptor()
          Returns the IJavaPropertyDescriptor for which this is a read accessor.
 short getShort(java.lang.Object obj)
          Gets the value of a static or instance property of type short or of another primitive type convertible to type short via a widening conversion.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaDescriptorReadAccessor

public JavaDescriptorReadAccessor(java.beans.PropertyDescriptor descriptor,
                                  IJavaPropertyDescriptor property)
Constructor, creates JavaDescriptorReadAccessor that reads the property value for the specified property using the specified PropertyDescriptor's read method.

Parameters:
descriptor - the PropertyDescriptor used to read the property value
property - the IJavaPropertyDescriptor for the property
Method Detail

getPropertyDescriptor

public IJavaPropertyDescriptor getPropertyDescriptor()
Returns the IJavaPropertyDescriptor for which this is a read accessor.

Specified by:
getPropertyDescriptor in interface IJavaReadAccessor
Returns:
IJavaPropertyDescriptor the property descriptor

get

public java.lang.Object get(java.lang.Object obj)
                     throws java.lang.IllegalArgumentException,
                            java.lang.IllegalAccessException,
                            gov.nasa.arc.brahms.common.exceptions.PropertyAccessException
Returns the value of the property represented by the IJavaPropertyDescriptor, on the specified object. The value is automatically wrapped in an object if it has a primitive type.

The underlying property's value is obtained as follows:

If the underlying property is a static property, the obj argument is ignored; it may be null.

Otherwise, the underlying property is an member property. If the specified obj argument is null, the method throws a NullPointerException. If the specified object is not an instance of the class or interface declaring the underlying property, the method throws an IllegalArgumentException.

Otherwise, the value is retrieved from the underlying instance or static property. If the property has a primitive type, the value is wrapped in an object before being returned, otherwise it is returned as is.

Specified by:
get in interface IJavaReadAccessor
Parameters:
obj - object from which the represented property's value is to be extracted
Returns:
Object the value of the represented property in object obj; primitive values are wrapped in an appropriate object before being returned
Throws:
java.lang.IllegalAccessException - if the underlying property is inaccessible.
java.lang.IllegalArgumentException - if the specified object is not an instance of the class or interface declaring the underlying property (or a subclass or implementor thereof).
gov.nasa.arc.brahms.common.exceptions.PropertyAccessException - if there was a problem reading the property's value
java.lang.NullPointerException - if the specified object is null and the property is a member property.
java.lang.ExceptionInInitializerError - if the initialization provoked by this method fails.

getBoolean

public boolean getBoolean(java.lang.Object obj)
                   throws java.lang.IllegalArgumentException,
                          java.lang.IllegalAccessException,
                          gov.nasa.arc.brahms.common.exceptions.PropertyAccessException
Gets the value of a static or instance boolean property.

Specified by:
getBoolean in interface IJavaReadAccessor
Parameters:
obj - the object to extract the boolean value from
Returns:
boolean the value of the boolean property
Throws:
java.lang.IllegalAccessException - if the underlying property is inaccessible.
java.lang.IllegalArgumentException - if the specified object is not an instance of the class or interface declaring the underlying property (or a subclass or implementor thereof), or if the property value cannot be converted to the type boolean by a widening conversion.
gov.nasa.arc.brahms.common.exceptions.PropertyAccessException - if there was a problem reading the property's value
java.lang.NullPointerException - if the specified object is null and the property is a member property.
java.lang.ExceptionInInitializerError - if the initialization provoked by this method fails.
See Also:
IJavaReadAccessor.get(java.lang.Object)

getByte

public byte getByte(java.lang.Object obj)
             throws java.lang.IllegalArgumentException,
                    java.lang.IllegalAccessException,
                    gov.nasa.arc.brahms.common.exceptions.PropertyAccessException
Gets the value of a static or instance byte property.

Specified by:
getByte in interface IJavaReadAccessor
Parameters:
obj - the object to extract the byte value from
Returns:
byte the value of the byte property
Throws:
java.lang.IllegalAccessException - if the underlying property is inaccessible.
java.lang.IllegalArgumentException - if the specified object is not an instance of the class or interface declaring the underlying property (or a subclass or implementor thereof), or if the property value cannot be converted to the type byte by a widening conversion.
gov.nasa.arc.brahms.common.exceptions.PropertyAccessException - if there was a problem reading the property's value
java.lang.NullPointerException - if the specified object is null and the property is an instance property.
java.lang.ExceptionInInitializerError - if the initialization provoked by this method fails.
See Also:
IJavaReadAccessor.get(java.lang.Object)

getChar

public char getChar(java.lang.Object obj)
             throws java.lang.IllegalArgumentException,
                    java.lang.IllegalAccessException,
                    gov.nasa.arc.brahms.common.exceptions.PropertyAccessException
Gets the value of a static or instance property of type char or of another primitive type convertible to type char via a widening conversion.

Specified by:
getChar in interface IJavaReadAccessor
Parameters:
obj - the object to extract the char value from
Returns:
char the value of the property converted to type char
Throws:
java.lang.IllegalAccessException - if the underlying property is inaccessible.
java.lang.IllegalArgumentException - if the specified object is not an instance of the class or interface declaring the underlying property (or a subclass or implementor thereof), or if the property value cannot be converted to the type char by a widening conversion.
gov.nasa.arc.brahms.common.exceptions.PropertyAccessException - if there was a problem reading the property's value
java.lang.NullPointerException - if the specified object is null and the property is an instance property.
java.lang.ExceptionInInitializerError - if the initialization provoked by this method fails.
See Also:
IJavaReadAccessor.get(java.lang.Object)

getShort

public short getShort(java.lang.Object obj)
               throws java.lang.IllegalArgumentException,
                      java.lang.IllegalAccessException,
                      gov.nasa.arc.brahms.common.exceptions.PropertyAccessException
Gets the value of a static or instance property of type short or of another primitive type convertible to type short via a widening conversion.

Specified by:
getShort in interface IJavaReadAccessor
Parameters:
obj - the object to extract the short value from
Returns:
short the value of the property converted to type short
Throws:
java.lang.IllegalAccessException - if the underlying property is inaccessible.
java.lang.IllegalArgumentException - if the specified object is not an instance of the class or interface declaring the underlying property (or a subclass or implementor thereof), or if the property value cannot be converted to the type short by a widening conversion.
gov.nasa.arc.brahms.common.exceptions.PropertyAccessException - if there was a problem reading the property's value
java.lang.NullPointerException - if the specified object is null and the property is an instance property.
java.lang.ExceptionInInitializerError - if the initialization provoked by this method fails.
See Also:
IJavaReadAccessor.get(java.lang.Object)

getInt

public int getInt(java.lang.Object obj)
           throws java.lang.IllegalArgumentException,
                  java.lang.IllegalAccessException,
                  gov.nasa.arc.brahms.common.exceptions.PropertyAccessException
Gets the value of a static or instance property of type int or of another primitive type convertible to type int via a widening conversion.

Specified by:
getInt in interface IJavaReadAccessor
Parameters:
obj - the object to extract the int value from
Returns:
int the value of the property converted to type int
Throws:
java.lang.IllegalAccessException - if the underlying property is inaccessible.
java.lang.IllegalArgumentException - if the specified object is not an instance of the class or interface declaring the underlying property (or a subclass or implementor thereof), or if the property value cannot be converted to the type int by a widening conversion.
gov.nasa.arc.brahms.common.exceptions.PropertyAccessException - if there was a problem reading the property's value
java.lang.NullPointerException - if the specified object is null and the property is an instance property.
java.lang.ExceptionInInitializerError - if the initialization provoked by this method fails.
See Also:
IJavaReadAccessor.get(java.lang.Object)

getLong

public long getLong(java.lang.Object obj)
             throws java.lang.IllegalArgumentException,
                    java.lang.IllegalAccessException,
                    gov.nasa.arc.brahms.common.exceptions.PropertyAccessException
Gets the value of a static or instance property of type long or of another primitive type convertible to type long via a widening conversion.

Specified by:
getLong in interface IJavaReadAccessor
Parameters:
obj - the object to extract the long value from
Returns:
long the value of the property converted to type long
Throws:
java.lang.IllegalAccessException - if the underlying property is inaccessible.
java.lang.IllegalArgumentException - if the specified object is not an instance of the class or interface declaring the underlying property (or a subclass or implementor thereof), or if the property value cannot be converted to the type long by a widening conversion.
gov.nasa.arc.brahms.common.exceptions.PropertyAccessException - if there was a problem reading the property's value
java.lang.NullPointerException - if the specified object is null and the property is an instance property.
java.lang.ExceptionInInitializerError - if the initialization provoked by this method fails.
See Also:
IJavaReadAccessor.get(java.lang.Object)

getFloat

public float getFloat(java.lang.Object obj)
               throws java.lang.IllegalArgumentException,
                      java.lang.IllegalAccessException,
                      gov.nasa.arc.brahms.common.exceptions.PropertyAccessException
Gets the value of a static or instance property of type float or of another primitive type convertible to type float via a widening conversion.

Specified by:
getFloat in interface IJavaReadAccessor
Parameters:
obj - the object to extract the float value from
Returns:
float the value of the property converted to type float
Throws:
java.lang.IllegalAccessException - if the underlying property is inaccessible.
java.lang.IllegalArgumentException - if the specified object is not an instance of the class or interface declaring the underlying property (or a subclass or implementor thereof), or if the property value cannot be converted to the type float by a widening conversion.
gov.nasa.arc.brahms.common.exceptions.PropertyAccessException - if there was a problem reading the property's value
java.lang.NullPointerException - if the specified object is null and the property is an instance property.
java.lang.ExceptionInInitializerError - if the initialization provoked by this method fails.
See Also:
IJavaReadAccessor.get(java.lang.Object)

getDouble

public double getDouble(java.lang.Object obj)
                 throws java.lang.IllegalArgumentException,
                        java.lang.IllegalAccessException,
                        gov.nasa.arc.brahms.common.exceptions.PropertyAccessException
Gets the value of a static or instance property of type double or of another primitive type convertible to type double via a widening conversion.

Specified by:
getDouble in interface IJavaReadAccessor
Parameters:
obj - the object to extract the double value from
Returns:
double the value of the property converted to type double
Throws:
java.lang.IllegalAccessException - if the underlying property is inaccessible.
java.lang.IllegalArgumentException - if the specified object is not an instance of the class or interface declaring the underlying property (or a subclass or implementor thereof), or if the property value cannot be converted to the type double by a widening conversion.
gov.nasa.arc.brahms.common.exceptions.PropertyAccessException - if there was a problem reading the property's value
java.lang.NullPointerException - if the specified object is null and the property is an instance property.
java.lang.ExceptionInInitializerError - if the initialization provoked by this method fails.
See Also:
IJavaReadAccessor.get(java.lang.Object)


Copyright © 1997-2012 All Rights Reserved.