com.atomikos.beans
Class PrimitiveClasses

java.lang.Object
  extended by com.atomikos.beans.PrimitiveClasses

public final class PrimitiveClasses
extends Object

A utility class for primitive class manipulation.


Constructor Summary
PrimitiveClasses()
           
 
Method Summary
static Object createWrapperObject(String val, Class primitiveClass)
          Constructs a wrapper object that holds a value for the given primitiveClass, based on the given String value.
static Class getWrapperClass(Class primitiveClass)
          Get the wrapper type for the given primitive.
static boolean isDecimalClass(Class clazz)
          Check if a class allows decimal numeric values.
static boolean isNumericClass(Class clazz)
          Check if a class should be restricted to numeric values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrimitiveClasses

public PrimitiveClasses()
Method Detail

isNumericClass

public static boolean isNumericClass(Class clazz)
Check if a class should be restricted to numeric values.

Parameters:
clazz - The class to test.
Returns:
boolean If true then the class allows only numeric values.

isDecimalClass

public static boolean isDecimalClass(Class clazz)
Check if a class allows decimal numeric values.

Parameters:
clazz - The class to test.
Returns:
boolean If true then the class allows decimal numeric values.

getWrapperClass

public static Class getWrapperClass(Class primitiveClass)
Get the wrapper type for the given primitive.

Parameters:
primitiveClass - The primitive class.
Returns:
Class The wrapper, or null if not a primitive.

createWrapperObject

public static Object createWrapperObject(String val,
                                         Class primitiveClass)
                                  throws ClassNotPrimitiveException
Constructs a wrapper object that holds a value for the given primitiveClass, based on the given String value.

Parameters:
val - The String value.
primitiveClass - The class for which the wrapper object should be made.
Returns:
Object The wrapper object.
Throws:
ClassNotPrimitiveException - If the supplied class is not recognized as a primitive class.


Copyright © 2011. All Rights Reserved.