|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectprefuse.util.TypeLib
public class TypeLib
Library routines dealing with Java Class types.
| Method Summary | |
|---|---|
static java.lang.Class |
getNumericType(java.lang.Class c1,
java.lang.Class c2)
Get a compatible numeric type for two primitive numeric class types. |
static java.lang.Class |
getPrimitiveType(java.lang.Class type)
Given a numeric (byte, short, int, long, float, or double) class type or associated wrapper class type, return the primitive class type |
static java.lang.Class |
getSharedType(java.lang.Class type1,
java.lang.Class type2)
Get the nearest shared ancestor class of two classes. |
static java.lang.Class |
getSharedType(java.lang.Object o1,
java.lang.Object o2)
Get the nearest shared ancestor class of two objects. |
static java.lang.Class |
getWrapperType(java.lang.Class type)
Get the wrapper class type for a primitive class type. |
static boolean |
isIntegerType(java.lang.Class type)
Indicates if a given class type is a primitive integer type (one of byte, short, int, or long). |
static boolean |
isNumericType(java.lang.Class type)
Indicates if a given class type is a primitive numeric one type (one of byte, short, int, long, float, or double). |
static boolean |
isWrapperInstance(java.lang.Class type,
java.lang.Object instance)
Indicates if an object is an instance of a wrapper class for a given primitive type. |
static boolean |
typeCheck(java.lang.Class type,
java.lang.Object instance)
Check if an object is an instance of a given class, or, if the class is a primitive type, if the Object is an instance of the wrapper class for that primitive (e.g., as Integer is a wrapper for int). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static boolean typeCheck(java.lang.Class type,
java.lang.Object instance)
type - the Class typeinstance - the Object instance
public static java.lang.Class getSharedType(java.lang.Object o1,
java.lang.Object o2)
o1 - the first objecto2 - the second object
public static java.lang.Class getSharedType(java.lang.Class type1,
java.lang.Class type2)
type1 - the first typetype2 - the second type
public static boolean isWrapperInstance(java.lang.Class type,
java.lang.Object instance)
type - the primitive Class typeinstance - the object to test as wrapper (e.g., as Integer is a
wrapper type for int)
public static java.lang.Class getPrimitiveType(java.lang.Class type)
type - the type to look up, must be a numerical type, but can be
either primitive or a wrapper.
public static java.lang.Class getWrapperType(java.lang.Class type)
type - a class type
public static boolean isIntegerType(java.lang.Class type)
type - the type to check
public static boolean isNumericType(java.lang.Class type)
type - the type to check
public static java.lang.Class getNumericType(java.lang.Class c1,
java.lang.Class c2)
c1 - a numeric primitive class type (int, long, float, or double)c2 - a numeric primitive class type (int, long, float, or double)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||