public class Primitives
extends java.lang.Object
Constructor and Description |
---|
Primitives() |
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
getDefaultValue(java.lang.Class cls)
Returns the default value of a primitive class,
or null if it is not a primitive class.
|
static char |
getNotation(java.lang.String className)
Returns the notation of a primitive class,
or ((char)0) if it is not a primitive class.
|
static boolean |
isPrimitive(java.lang.String clsName)
Tests whether a class name is a primitive class, e.g., int and void.
|
static java.lang.Class |
toClass(java.lang.String clsName)
Converts a primitive from name to the class,
or null if it is not a primitive class.
|
static boolean |
toPrimitive(java.lang.Boolean obj)
Convert Boolean object to primitive boolean.
|
static byte |
toPrimitive(java.lang.Byte obj)
Convert Byte object to primitive byte.
|
static char |
toPrimitive(java.lang.Character obj)
Convert Character object to primitive char.
|
static java.lang.Class |
toPrimitive(java.lang.Class wrapper)
Returns the primitive class of the giving wrapper class,
or null if it is not a wrapper class.
|
static double |
toPrimitive(java.lang.Double obj)
Convert Double object to primitive double.
|
static float |
toPrimitive(java.lang.Float obj)
Convert Float object to primitive float.
|
static int |
toPrimitive(java.lang.Integer obj)
Convert Integer object to primitive int.
|
static long |
toPrimitive(java.lang.Long obj)
Convert Long object to primitive long.
|
static short |
toPrimitive(java.lang.Short obj)
Convert Short object to primitive short.
|
static java.lang.Boolean |
toWrapper(boolean obj)
Convert primitive boolean to Boolean.
|
static java.lang.Byte |
toWrapper(byte obj)
Convert primitive byte to Byte.
|
static java.lang.Character |
toWrapper(char obj)
Convert primitive char to Character.
|
static java.lang.Class |
toWrapper(java.lang.Class primitive)
Returns the wrapper class of a primitive class,
or null if it is not a primitive class.
|
static java.lang.Double |
toWrapper(double obj)
Convert primitive double to Double.
|
static java.lang.Float |
toWrapper(float obj)
Convert primitive float to Float.
|
static java.lang.Integer |
toWrapper(int obj)
Convert primitive int to Integer.
|
static java.lang.Long |
toWrapper(long obj)
Convert primitive long to Long.
|
static java.lang.Short |
toWrapper(short obj)
Convert primitive short to Short.
|
public static final boolean toPrimitive(java.lang.Boolean obj)
public static final java.lang.Boolean toWrapper(boolean obj)
public static final byte toPrimitive(java.lang.Byte obj)
public static final java.lang.Byte toWrapper(byte obj)
public static final char toPrimitive(java.lang.Character obj)
public static final java.lang.Character toWrapper(char obj)
public static final double toPrimitive(java.lang.Double obj)
public static final java.lang.Double toWrapper(double obj)
public static final float toPrimitive(java.lang.Float obj)
public static final java.lang.Float toWrapper(float obj)
public static final int toPrimitive(java.lang.Integer obj)
public static final java.lang.Integer toWrapper(int obj)
public static final long toPrimitive(java.lang.Long obj)
public static final java.lang.Long toWrapper(long obj)
public static final short toPrimitive(java.lang.Short obj)
public static final java.lang.Short toWrapper(short obj)
public static final char getNotation(java.lang.String className)
public static final java.lang.Object getDefaultValue(java.lang.Class cls)
public static final java.lang.Class toClass(java.lang.String clsName)
Example, toClass("int") returns int.class.
public static final java.lang.Class toPrimitive(java.lang.Class wrapper)
Example, toPrimitive(Integer.class) returns int.class.
public static final java.lang.Class toWrapper(java.lang.Class primitive)
Example, toWrapper(int.class) return Integer.class.
public static final boolean isPrimitive(java.lang.String clsName)
Copyright © 2005-2011 Potix Corporation. All Rights Reserved.