Class TypeId
- java.lang.Object
-
- net.haesleinhuepf.clij.coremem.util.TypeId
-
public class TypeId extends Object
Utility class with static methods to identify data types.- Author:
- royer
-
-
Constructor Summary
Constructors Constructor Description TypeId()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intclassToId(Class<?> pClass)Returns an integer ID for a primitive type based on primitive type class.static Class<?>idToClass(int pPrimitiveTypeId)Returns the class of a primitive type given a primitive type integer ID.static booleanis16bitInt(Class<?> pType)Returns true if the given class corresponds to a 16 bit int type.static booleanisByte(Class<?> pType)Returns true if the given class corresponds to a byte.static booleanisChar(Class<?> pType)Returns true if the given class corresponds to a char.static booleanisDouble(Class<?> pType)Returns true if the given class corresponds to a double.static booleanisFloat(Class<?> pType)Returns true if the given class corresponds to a float.static booleanisFloatingPointType(Class<?> pClass)Return true if the given class corresponds to a float primitive type (float or double)static booleanisInt(Class<?> pType)Returns true if the given class corresponds to a int.static booleanisLong(Class<?> pType)Returns true if the given class corresponds to a long.static booleanisShort(Class<?> pType)Returns true if the given class corresponds to a short.
-
-
-
Method Detail
-
classToId
public static int classToId(Class<?> pClass)
Returns an integer ID for a primitive type based on primitive type class.- Parameters:
pClass- class- Returns:
- integer id
-
idToClass
public static Class<?> idToClass(int pPrimitiveTypeId)
Returns the class of a primitive type given a primitive type integer ID.- Parameters:
pPrimitiveTypeId- primitive type ID- Returns:
- corresponding class.
-
isFloatingPointType
public static boolean isFloatingPointType(Class<?> pClass)
Return true if the given class corresponds to a float primitive type (float or double)- Parameters:
pClass- class- Returns:
- true if float type, false otherwise
-
isByte
public static boolean isByte(Class<?> pType)
Returns true if the given class corresponds to a byte.- Parameters:
pType- type class- Returns:
- true if yes, false otherwise
-
isChar
public static boolean isChar(Class<?> pType)
Returns true if the given class corresponds to a char.- Parameters:
pType- type class- Returns:
- true if yes, false otherwise
-
isShort
public static boolean isShort(Class<?> pType)
Returns true if the given class corresponds to a short.- Parameters:
pType- type class- Returns:
- true if yes, false otherwise
-
isInt
public static boolean isInt(Class<?> pType)
Returns true if the given class corresponds to a int.- Parameters:
pType- type class- Returns:
- true if yes, false otherwise
-
isLong
public static boolean isLong(Class<?> pType)
Returns true if the given class corresponds to a long.- Parameters:
pType- type class- Returns:
- true if yes, false otherwise
-
isFloat
public static boolean isFloat(Class<?> pType)
Returns true if the given class corresponds to a float.- Parameters:
pType- type class- Returns:
- true if yes, false otherwise
-
isDouble
public static boolean isDouble(Class<?> pType)
Returns true if the given class corresponds to a double.- Parameters:
pType- type class- Returns:
- true if yes, false otherwise
-
is16bitInt
public static boolean is16bitInt(Class<?> pType)
Returns true if the given class corresponds to a 16 bit int type.- Parameters:
pType- type class- Returns:
- true if yes, false otherwise
-
-