com.go.tea.util
Class BeanAnalyzer

java.lang.Object
  |
  +--com.go.tea.util.BeanAnalyzer

public class BeanAnalyzer
extends java.lang.Object

The JavaBean Introspector for Tea.

Version:
13 , 00/12/13
Author:
Brian S O'Neill
See Also:
Introspector

Field Summary
static java.lang.String ELEMENT_TYPE_FIELD_NAME
          The name of the special field that specializes a keyed property type: "ELEMENT_TYPE"
static java.lang.String KEYED_PROPERTY_NAME
          The name given to keyed properties: "[]"
static java.lang.String LENGTH_PROPERTY_NAME
          The name given to the length property: "length"
 
Constructor Summary
BeanAnalyzer()
           
 
Method Summary
static java.util.Map getAllProperties(java.lang.Class clazz)
          A function that returns a Map of all the available properties on a given class including write-only properties.
static void main(java.lang.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 java.lang.String LENGTH_PROPERTY_NAME
The name given to the length property: "length"

KEYED_PROPERTY_NAME

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

ELEMENT_TYPE_FIELD_NAME

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

BeanAnalyzer

public BeanAnalyzer()
Method Detail

main

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

getAllProperties

public static java.util.Map getAllProperties(java.lang.Class clazz)
                                      throws java.beans.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.