org.vizzini.util
Class ClassAnalyzer

java.lang.Object
  extended by org.vizzini.util.ClassAnalyzer

public class ClassAnalyzer
extends Object

Provides an analyzer of class constructor, accessor and mutator methods.

Since:
v0.2
Version:
v0.3
Author:
Jeffrey M. Thompson

Method Summary
static void clear()
          Clear the cached analyzers.
 Collection getAccessiblePropertyNames()
          Return the property names of the accessor methods.
 Collection getAccessiblePropertyNamesAlphabetized()
          Return an alphabetized collection of property names of the accessor methods.
 Method getAccessorMethodFor(String propertyName)
          Return the accessor method for the given property name.
 Collection getAccessorMethods()
          Return the accessor methods.
static ClassAnalyzer getInstance(Class aClass)
          Return a class analyzer instance.
static ClassAnalyzer getInstance(String className)
          Return a class analyzer instance.
 Collection getMutablePropertyNames()
          Return the property names of the mutator methods.
 Collection getMutablePropertyNamesAlphabetized()
          Return an alphabetized collection of property names of the accessor methods.
 Method getMutatorMethodFor(String propertyName)
          Return the mutator method for the given property name.
 Collection getMutatorMethods()
          Return the mutator methods.
 Constructor getNoArgConstructor()
          Return the no-arg constructor.
 Class getPropertyType(String propertyName)
          Return the type of the given property.
 Class getSubjectClass()
          Return the subject class.
static Object getValue(Object object, String propertyName)
          Return the value of the given property from the given object.
static void setValue(Object object, String propertyName, Object newValue)
          Set the given value of the given property on the given object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

clear

public static void clear()
Clear the cached analyzers.

Since:
v0.2

getInstance

public static ClassAnalyzer getInstance(String className)
Return a class analyzer instance. Clients must use this method to obtain analyzer objects which are cached as they are created.

Since:
v0.2

getInstance

public static ClassAnalyzer getInstance(Class aClass)
Return a class analyzer instance. Clients must use this method to obtain analyzer objects which are cached as they are created.

Since:
v0.2

getValue

public static Object getValue(Object object,
                              String propertyName)
                       throws IllegalAccessException,
                              InvocationTargetException
Return the value of the given property from the given object. The property name may be chained, e.g. engine.environment.

Parameters:
propertyName -
object -
Throws:
IllegalAccessException
InvocationTargetException
Since:
v0.2

setValue

public static void setValue(Object object,
                            String propertyName,
                            Object newValue)
                     throws IllegalAccessException,
                            InvocationTargetException
Set the given value of the given property on the given object. The property name may be chained, e.g. engine.environment.

Parameters:
propertyName -
object -
Throws:
IllegalAccessException
InvocationTargetException
Since:
v0.2

getAccessiblePropertyNames

public Collection getAccessiblePropertyNames()
Return the property names of the accessor methods.

Since:
v0.2

getAccessiblePropertyNamesAlphabetized

public Collection getAccessiblePropertyNamesAlphabetized()
Return an alphabetized collection of property names of the accessor methods.

Since:
v0.2

getAccessorMethodFor

public Method getAccessorMethodFor(String propertyName)
Return the accessor method for the given property name.

Since:
v0.2

getAccessorMethods

public Collection getAccessorMethods()
Return the accessor methods.

Since:
v0.2

getMutablePropertyNames

public Collection getMutablePropertyNames()
Return the property names of the mutator methods.

Since:
v0.2

getMutablePropertyNamesAlphabetized

public Collection getMutablePropertyNamesAlphabetized()
Return an alphabetized collection of property names of the accessor methods.

Since:
v0.2

getMutatorMethodFor

public Method getMutatorMethodFor(String propertyName)
Return the mutator method for the given property name.

Since:
v0.2

getMutatorMethods

public Collection getMutatorMethods()
Return the mutator methods.

Since:
v0.2

getNoArgConstructor

public Constructor getNoArgConstructor()
Return the no-arg constructor.

Since:
v0.2

getPropertyType

public Class getPropertyType(String propertyName)
Return the type of the given property.

Since:
v0.3

getSubjectClass

public Class getSubjectClass()
Return the subject class.

Since:
v0.2


Copyright 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02