org.teatrove.tea.util
Class BeanAnalyzer

java.lang.Object
  extended by org.teatrove.tea.util.BeanAnalyzer

public class BeanAnalyzer
extends Object

The JavaBean Introspector for Tea.

Author:
Brian S O'Neill
See Also:
Introspector

Field Summary
static String ELEMENT_TYPE_FIELD_NAME
          The name of the special field that specializes a keyed property type: "ELEMENT_TYPE"
static String KEYED_PROPERTY_NAME
          The name given to keyed properties: "[]"
static String LENGTH_PROPERTY_NAME
          The name given to the length property: "length"
 
Constructor Summary
BeanAnalyzer()
           
 
Method Summary
static Map<String,PropertyDescriptor> getAllProperties(GenericType root)
          A function that returns a Map of all the available properties on a given class including write-only properties.
static void main(String[] args)
          Test program.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LENGTH_PROPERTY_NAME

public static final String LENGTH_PROPERTY_NAME
The name given to the length property: "length"

See Also:
Constant Field Values

KEYED_PROPERTY_NAME

public static final String KEYED_PROPERTY_NAME
The name given to keyed properties: "[]"

See Also:
Constant Field Values

ELEMENT_TYPE_FIELD_NAME

public static final String ELEMENT_TYPE_FIELD_NAME
The name of the special field that specializes a keyed property type: "ELEMENT_TYPE"

See Also:
Constant Field Values
Constructor Detail

BeanAnalyzer

public BeanAnalyzer()
Method Detail

main

public static void main(String[] args)
                 throws Exception
Test program.

Throws:
Exception

getAllProperties

public static Map<String,PropertyDescriptor> getAllProperties(GenericType root)
                                                       throws IntrospectionException
A function that returns a Map of all the available properties on a given class including write-only properties. The properties returned is mostly a superset of those returned from the standard JavaBeans Introspector except pure indexed properties are discarded.

Interfaces receive all the properties available in Object. Arrays, Strings and Collections all receive a "length" property. An array's "length" PropertyDescriptor has no read or write methods.

Instead of indexed properties, there may be keyed properties in the map, represented by a KeyedPropertyDescriptor. Arrays, Strings and Lists always have keyed properties with a key type of int.

Because the value returned from a keyed property method may be more specific than the method signature describes (such is often the case with collections), a bean class can contain a special field that indicates what that specific type should be. The signature of this field is as follows: public static final Class ELEMENT_TYPE = <type>.class;.

Returns:
an unmodifiable mapping of property names (Strings) to PropertyDescriptor objects.
Throws:
IntrospectionException


Copyright © 1997-2012 TeaTrove.org. All Rights Reserved.