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

java.lang.Object
  extended by gov.nasa.arc.brahms.common.data.JavaIntrospector

public class JavaIntrospector
extends java.lang.Object

JavaIntrospector is a class used to find and obtain the accessor properties for Java objects and classes to allow Brahms actors to set/get Java property values.

This class uses Java's Introspector class to obtain BeanInfo describing the available properties, events, and methods of a Java class, but will also use Java's reflection to find other means to define accessors for a Java class or object's properties (methods or member variables).

Because the JavaIntrospector caches JavaClassInfo classes for better performance, take care if you use it in an application that uses multiple class loaders. In general, when you destroy a ClassLoader that has been used to introspect classes, you should use the JavaIntrospector.flushCaches or JavaIntrospector.flushFromCaches method to flush all of the introspected classes out of the cache.

Version:
$Revision: 1.1 $ $Date: 2009/11/23 18:28:41 $ $Author: rnado $
Author:
Ron van Hoof
See Also:
Introspector, BeanInfo

Constructor Summary
JavaIntrospector()
           
 
Method Summary
static void flushCaches()
          Flush all of the JavaIntrospector's internal caches.
static void flushFromCaches(java.lang.Class<?> clz)
          Flush the JavaIntrospector's internal cached information for a given class.
static JavaClassInfo getJavaClassInfo(java.lang.Class<?> clz)
          Introspect on a Java Class and learn about all its properties, exposed methods, and events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaIntrospector

public JavaIntrospector()
Method Detail

getJavaClassInfo

public static JavaClassInfo getJavaClassInfo(java.lang.Class<?> clz)
                                      throws java.beans.IntrospectionException
Introspect on a Java Class and learn about all its properties, exposed methods, and events. If the JavaClassInfo class for a Java Class has been previously introspected then the JavaClassInfo class is retrieved from the JavaClassInfo cache.

Parameters:
clz - the Java class to be analyzed
Returns:
JavaClassInfo a JavaClassInfo object describing the Java class
Throws:
java.beans.IntrospectionException - if an exception occurs during introspection

flushCaches

public static void flushCaches()
Flush all of the JavaIntrospector's internal caches. This method is not normally required. It is normally only needed by advanced tools that update existing "Class" objects in-place and need to make the JavaIntrospector re-analyze existing Class objects.


flushFromCaches

public static void flushFromCaches(java.lang.Class<?> clz)
Flush the JavaIntrospector's internal cached information for a given class. This method is not normally required. It is normally only needed by advanced tools that update existing "Class" objects in-place and need to make the Introspector re-analyze an existing Class object. Note that only the direct state associated with the target Class object is flushed. We do not flush state for other Class objects with the same name, nor do we flush state for any related Class objects (such as subclasses), even though their state may include information indirectly obtained from the target Class object.

Parameters:
clz - Class object to be flushed.
Throws:
java.lang.NullPointerException - If the Class object is null.


Copyright © 1997-2012 All Rights Reserved.