public class TypeLib
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
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).
|
public static boolean typeCheck(java.lang.Class type,
java.lang.Object instance)
type - the Class typeinstance - the Object instancepublic static java.lang.Class getSharedType(java.lang.Object o1,
java.lang.Object o2)
o1 - the first objecto2 - the second objectpublic static java.lang.Class getSharedType(java.lang.Class type1,
java.lang.Class type2)
type1 - the first typetype2 - the second typepublic 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 typepublic static boolean isIntegerType(java.lang.Class type)
type - the type to checkpublic static boolean isNumericType(java.lang.Class type)
type - the type to checkpublic 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)