gov.nih.nci.cagrid.data.sdk32query
Class ClassAccessUtilities

java.lang.Object
  extended by gov.nih.nci.cagrid.data.sdk32query.ClassAccessUtilities

public class ClassAccessUtilities
extends java.lang.Object

ClassAccessUtilities A package of utilities for accessing classes in the context of CQL query processing

Version:
$Id: ClassAccessUtilities.java,v 1.3 2007/04/02 14:13:44 dervin Exp $
Author:
David W. Ervin

Constructor Summary
ClassAccessUtilities()
           
 
Method Summary
static java.lang.reflect.Field[] getFieldsOfType(java.lang.Class clazz, java.lang.String typeName)
          Gets all fields from a class and it's superclasses of a given type
static java.lang.reflect.Field getNamedField(java.lang.Class clazz, java.lang.String fieldName)
          Gets the named field from the class or any of its super classes
static java.lang.reflect.Method getNamedGetterMethod(java.lang.Class clazz, java.lang.String fieldName)
          Gets the 'getter' method from the class or any of its super classes for a named field.
static java.lang.String getRoleName(java.lang.String parentName, Association assoc)
          Gets the role name of an association relative to its parent class.
static java.lang.reflect.Method[] getSettersForType(java.lang.Class clazz, java.lang.String typeName)
          Gets the setter methods of a class that take a parameter of a certain type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassAccessUtilities

public ClassAccessUtilities()
Method Detail

getRoleName

public static java.lang.String getRoleName(java.lang.String parentName,
                                           Association assoc)
                                    throws QueryProcessingException
Gets the role name of an association relative to its parent class.

Parameters:
parentName - The class name of the parent of the association
assoc - The associated object restriction
Returns:
The role name of the associated object
Throws:
QueryProcessingException

getFieldsOfType

public static java.lang.reflect.Field[] getFieldsOfType(java.lang.Class clazz,
                                                        java.lang.String typeName)
Gets all fields from a class and it's superclasses of a given type

Parameters:
clazz - The class to explore for typed fields
typeName - The name of the type to search for
Returns:
All Fields from the class of the specified type

getSettersForType

public static java.lang.reflect.Method[] getSettersForType(java.lang.Class clazz,
                                                           java.lang.String typeName)
Gets the setter methods of a class that take a parameter of a certain type

Parameters:
clazz - The class to find setter methods on
typeName - The name of the type to find setters for
Returns:
All setter methods which take a parameter of the named type

getNamedField

public static java.lang.reflect.Field getNamedField(java.lang.Class clazz,
                                                    java.lang.String fieldName)
Gets the named field from the class or any of its super classes

Parameters:
clazz - The class to retrieve a field from
fieldName - The name of the field to retrieve
Returns:
The named field, or null if it was not found

getNamedGetterMethod

public static java.lang.reflect.Method getNamedGetterMethod(java.lang.Class clazz,
                                                            java.lang.String fieldName)
Gets the 'getter' method from the class or any of its super classes for a named field. For example, if a field name of 'foo' is given, this method looks for a method named getFoo on the class.

Parameters:
clazz - The class to retrieve a getter method from
fieldName - The name of the field
Returns:
The getter method for the field, or null if it was not found