org.progeeks.meta.beans
Class BeanUtils

java.lang.Object
  extended by org.progeeks.meta.beans.BeanUtils

public class BeanUtils
extends java.lang.Object

Provides utility methods for bean introspection.

Version:
$Revision: 1.31 $
Author:
Paul Speed

Nested Class Summary
static class BeanUtils.BeanTemplateFactory
          Introspects a bean class to create a MetaObject representing the properties and other information necessary to create the MetaClass.
 
Field Summary
static BeanUtils.BeanTemplateFactory TEMPLATE_FACTORY
          Constant factory that can create a MetaObject representing the properties and other information for a bean class.
 
Constructor Summary
BeanUtils()
           
 
Method Summary
static MetaClass createBeanMetaClass(java.lang.Class javaClass)
          Creates a meta-class for the specified Java class using the context class registry.
static MetaClass createBeanMetaClass(java.lang.Class javaClass, java.util.List propertyInfos)
          Creates a meta-class for the specified Java class using the root class registry.
static MetaClass createBeanMetaClass(java.lang.Class javaClass, java.lang.String[] uniqueFields)
          Creates a meta-class for the specified Java class using the context class registry.
static MetaClass createBeanMetaClass(MetaClassRegistry classRegistry, java.lang.Class javaClass)
          Creates a meta-class for the specified Java class using the specified class registry.
static MetaClass createBeanMetaClass(MetaClassRegistry classRegistry, java.lang.Class javaClass, java.util.List propertyInfos)
          Creates a meta-class for the specified Java class using the specified class registry and property info list.
static MetaClass createBeanMetaClass(MetaClassRegistry classRegistry, java.lang.Class javaClass, java.util.List propertyInfos, java.lang.String[] uniqueFields)
          Creates a meta-class for the specified Java class using the specified class registry and unique field list.
static MetaClass createBeanMetaClass(MetaClassRegistry classRegistry, java.lang.Class javaClass, java.lang.String[] uniqueFields)
          Creates a meta-class for the specified Java class using the specified class registry and unique field list.
static MetaClass findBeanMetaClass(java.lang.Class type)
          Returns the appropriate meta-class for the specified Java class searching in the context class registry.
static MetaClass findBeanMetaClass(java.lang.Class type, MetaClassRegistry classRegistry)
          Returns the appropriate meta-class for the specified Java class.
static MetaObjectFactory getBeanFactory()
          Returns a factory that can be used to create new BeanMetaObjects based on a MetaClass.
static MetaClass getBeanMetaClass(java.lang.Class type)
          Returns the appropriate meta-class for the specified Java class searching in the context class registry.
static MetaClass getBeanMetaClass(java.lang.Class type, MetaClassRegistry classRegistry)
          Returns the appropriate meta-class for the specified Java class.
static java.util.List getBeanPropertyInfos(java.lang.Class javaClass)
          Retrieves the list of property info objects for the specified Java class by using bean introspection.
static java.util.List getBeanPropertyInfos(java.lang.Class javaClass, boolean resolveTypes)
          Retrieves the list of property info objects for the specified Java class by using bean introspection.
static java.util.List getBeanPropertyInfos(MetaClassRegistry classRegistry, java.lang.Class javaClass)
          Retrieves the list of property info objects for the specified Java class by using bean introspection.
static java.util.List getBeanPropertyInfos(MetaClassRegistry classRegistry, java.lang.Class javaClass, boolean resolveTypes)
          Retrieves the list of property info objects for the specified Java class by using bean introspection.
static java.lang.Class getClassForMetaClass(MetaClass type)
          Attempts to do a reverse-lookup to find the Java class for a given meta-class.
static MetaKit getMetaKit()
          Returns the meta-kit for this implementation.
static java.lang.String getNameForClass(java.lang.Class javaClass)
          Returns the MetaClass name that would be used for the specified Java class.
protected static void introspectClass(java.lang.Class javaClass, org.progeeks.meta.beans.BeanUtils.PropertyIntrospection pi)
          Internal method used to introspect the bean properties for the given java class.
protected static void introspectInterface(java.lang.Class javaClass, org.progeeks.meta.beans.BeanUtils.PropertyIntrospection pi)
           
static void main(java.lang.String[] args)
          For testing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEMPLATE_FACTORY

public static final BeanUtils.BeanTemplateFactory TEMPLATE_FACTORY
Constant factory that can create a MetaObject representing the properties and other information for a bean class.

Constructor Detail

BeanUtils

public BeanUtils()
Method Detail

getMetaKit

public static MetaKit getMetaKit()
Returns the meta-kit for this implementation.


getBeanFactory

public static MetaObjectFactory getBeanFactory()
Returns a factory that can be used to create new BeanMetaObjects based on a MetaClass.


createBeanMetaClass

public static MetaClass createBeanMetaClass(MetaClassRegistry classRegistry,
                                            java.lang.Class javaClass)
                                     throws java.beans.IntrospectionException
Creates a meta-class for the specified Java class using the specified class registry.

Throws:
java.beans.IntrospectionException

createBeanMetaClass

public static MetaClass createBeanMetaClass(MetaClassRegistry classRegistry,
                                            java.lang.Class javaClass,
                                            java.util.List propertyInfos)
                                     throws java.beans.IntrospectionException
Creates a meta-class for the specified Java class using the specified class registry and property info list. The specified java class is only used to generate the class name. The list of properties should be the same as, or a modified version, of what would be returned from getBeanPropertyInfos().

Throws:
java.beans.IntrospectionException

createBeanMetaClass

public static MetaClass createBeanMetaClass(MetaClassRegistry classRegistry,
                                            java.lang.Class javaClass,
                                            java.lang.String[] uniqueFields)
                                     throws java.beans.IntrospectionException
Creates a meta-class for the specified Java class using the specified class registry and unique field list. The unique fields are used to determine MetaObject equivalence.

Throws:
java.beans.IntrospectionException

createBeanMetaClass

public static MetaClass createBeanMetaClass(MetaClassRegistry classRegistry,
                                            java.lang.Class javaClass,
                                            java.util.List propertyInfos,
                                            java.lang.String[] uniqueFields)
                                     throws java.beans.IntrospectionException
Creates a meta-class for the specified Java class using the specified class registry and unique field list. The unique fields are used to determine MetaObject equivalence.

Throws:
java.beans.IntrospectionException

createBeanMetaClass

public static MetaClass createBeanMetaClass(java.lang.Class javaClass)
                                     throws java.beans.IntrospectionException
Creates a meta-class for the specified Java class using the context class registry.

Throws:
java.beans.IntrospectionException

createBeanMetaClass

public static MetaClass createBeanMetaClass(java.lang.Class javaClass,
                                            java.util.List propertyInfos)
                                     throws java.beans.IntrospectionException
Creates a meta-class for the specified Java class using the root class registry.

Throws:
java.beans.IntrospectionException

createBeanMetaClass

public static MetaClass createBeanMetaClass(java.lang.Class javaClass,
                                            java.lang.String[] uniqueFields)
                                     throws java.beans.IntrospectionException
Creates a meta-class for the specified Java class using the context class registry.

Throws:
java.beans.IntrospectionException

getNameForClass

public static java.lang.String getNameForClass(java.lang.Class javaClass)
Returns the MetaClass name that would be used for the specified Java class.


getBeanPropertyInfos

public static java.util.List getBeanPropertyInfos(MetaClassRegistry classRegistry,
                                                  java.lang.Class javaClass,
                                                  boolean resolveTypes)
                                           throws java.beans.IntrospectionException
Retrieves the list of property info objects for the specified Java class by using bean introspection.

Throws:
java.beans.IntrospectionException

introspectInterface

protected static void introspectInterface(java.lang.Class javaClass,
                                          org.progeeks.meta.beans.BeanUtils.PropertyIntrospection pi)
                                   throws java.beans.IntrospectionException
Throws:
java.beans.IntrospectionException

introspectClass

protected static void introspectClass(java.lang.Class javaClass,
                                      org.progeeks.meta.beans.BeanUtils.PropertyIntrospection pi)
                               throws java.beans.IntrospectionException
Internal method used to introspect the bean properties for the given java class. This will not do any special handling for interfaces, etc..

Throws:
java.beans.IntrospectionException

getBeanPropertyInfos

public static java.util.List getBeanPropertyInfos(MetaClassRegistry classRegistry,
                                                  java.lang.Class javaClass)
                                           throws java.beans.IntrospectionException
Retrieves the list of property info objects for the specified Java class by using bean introspection. Normal property types will be marked deferred and resolved at a later time.

Throws:
java.beans.IntrospectionException

getBeanPropertyInfos

public static java.util.List getBeanPropertyInfos(java.lang.Class javaClass)
                                           throws java.beans.IntrospectionException
Retrieves the list of property info objects for the specified Java class by using bean introspection. Any dependent MetaClass lookups are done using the context class registry. Normal property types will be marked deferred and resolved at a later time.

Throws:
java.beans.IntrospectionException

getBeanPropertyInfos

public static java.util.List getBeanPropertyInfos(java.lang.Class javaClass,
                                                  boolean resolveTypes)
                                           throws java.beans.IntrospectionException
Retrieves the list of property info objects for the specified Java class by using bean introspection. Any dependent MetaClass lookups are done using the root class registry.

Throws:
java.beans.IntrospectionException

getBeanMetaClass

public static MetaClass getBeanMetaClass(java.lang.Class type,
                                         MetaClassRegistry classRegistry)
Returns the appropriate meta-class for the specified Java class. If an appropriate meta-class has not been registered then this method returns null.


getBeanMetaClass

public static MetaClass getBeanMetaClass(java.lang.Class type)
Returns the appropriate meta-class for the specified Java class searching in the context class registry. If an appropriate meta-class has not been registered then this method returns null.


findBeanMetaClass

public static MetaClass findBeanMetaClass(java.lang.Class type,
                                          MetaClassRegistry classRegistry)
Returns the appropriate meta-class for the specified Java class. The specified class is checked as are any of its superclasses/superinterfaces and so on until a meta-class is found. If an appropriate meta-class has not been registered then this method returns null.


findBeanMetaClass

public static MetaClass findBeanMetaClass(java.lang.Class type)
Returns the appropriate meta-class for the specified Java class searching in the context class registry. If an appropriate meta-class has not been registered then this method returns null.


getClassForMetaClass

public static java.lang.Class getClassForMetaClass(MetaClass type)
Attempts to do a reverse-lookup to find the Java class for a given meta-class.


main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
For testing.

Throws:
java.lang.Exception


Copyright © 2002-2003 Paul Speed. All Rights Reserved.