com.tc.util
Class ClassUtils

java.lang.Object
  extended by com.tc.util.ClassUtils

public class ClassUtils
extends java.lang.Object

Class utility methods


Nested Class Summary
static interface ClassUtils.ClassSpec
          Holder for a class name and field name which together fully identify a field
 
Constructor Summary
ClassUtils()
           
 
Method Summary
static int arrayDimensions(java.lang.Class arrayClass)
          Get the dimension of an array
static java.lang.Class baseComponentType(java.lang.Class c)
          If c is an array, return the reifiable type of the array element
static boolean isDsoEnum(java.lang.Class c)
          Determine whether the class is an enum as far as DSO is concerned
static boolean isPortableReflectionClass(java.lang.Class c)
          Check whether c is a portable java reflection class like Method, Constructor, or Field
static boolean isPrimitiveArray(java.lang.Object test)
          Determine whether test is a primitive array
static ClassUtils.ClassSpec parseFullyQualifiedFieldName(java.lang.String fieldName)
          Convert fully-qualified field name like "mypackage.MyClass.myField" into a specification which contains the fully-qualified class name and the field name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassUtils

public ClassUtils()
Method Detail

parseFullyQualifiedFieldName

public static ClassUtils.ClassSpec parseFullyQualifiedFieldName(java.lang.String fieldName)
                                                         throws java.text.ParseException
Convert fully-qualified field name like "mypackage.MyClass.myField" into a specification which contains the fully-qualified class name and the field name.

Parameters:
fieldName - Fully-qualified field name
Returns:
Specification of class/field names
Throws:
java.text.ParseException - If the fieldName is not properly formatted

arrayDimensions

public static int arrayDimensions(java.lang.Class arrayClass)
Get the dimension of an array

Parameters:
arrayClass - The array class
Returns:
Dimension, >= 0
Throws:
java.lang.NullPointerException - If arrayClass is null
java.lang.IllegalArgumentException - If arrayClass is not an array class

baseComponentType

public static java.lang.Class baseComponentType(java.lang.Class c)
If c is an array, return the reifiable type of the array element

Parameters:
c - Array class
Returns:
Type of an array element
Throws:
java.lang.NullPointerException - If arrayClass is null
java.lang.IllegalArgumentException - If arrayClass is not an array class

isPrimitiveArray

public static boolean isPrimitiveArray(java.lang.Object test)
Determine whether test is a primitive array

Parameters:
test - The object
Returns:
True if test is a non-null primitive array

isDsoEnum

public static boolean isDsoEnum(java.lang.Class c)
Determine whether the class is an enum as far as DSO is concerned

Parameters:
c - Class
Returns:
True if enum

isPortableReflectionClass

public static boolean isPortableReflectionClass(java.lang.Class c)
Check whether c is a portable java reflection class like Method, Constructor, or Field

Parameters:
c - Class
Returns:
True if portable


Copyright © 2010 Terracotta, Inc.. All Rights Reserved.