wox.serial
Class Util

java.lang.Object
  extended by wox.serial.Util
All Implemented Interfaces:
Serial

public class Util
extends java.lang.Object
implements Serial

The Util class provides static methods that are used by SimpleReader and SimpleWriter. The methods of this class are used by the serialization and de-serialization processes.

Version:
Util.java - 1.0
Author:
Carlos R. Jaimez Gonzalez
Simon M. Lucas

Field Summary
 
Fields inherited from interface wox.serial.Serial
ARRAY, ARRAYLIST, DECLARED, ELEMENT_TYPE, ENTRY, FIELD, ID, IDREF, KEY, KEY_TYPE, LENGTH, MAP, NAME, OBJECT, primitiveArrays, primitiveArraysWOX, primitives, primitiveWrappers, TYPE, VALUE, VALUE_TYPE
 
Constructor Summary
Util()
           
 
Method Summary
static java.lang.reflect.Constructor forceDefaultConstructor(java.lang.Class cl)
          This method returns a default constructor for the specified class.
static boolean primitive(java.lang.Class type)
          This method returns true if the class passed as parameter is one of the valid primitive arrays classes supported by WOX.
static boolean stringable(java.lang.Class type)
          Returns true if the class passed as parameter is stringable.
static boolean stringable(java.lang.Object o)
          Returns true if the class of the object passed as parameter is stringable.
static boolean stringable(java.lang.String name)
          Returns true if the class which name is passed as parameter is stringable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

forceDefaultConstructor

public static java.lang.reflect.Constructor forceDefaultConstructor(java.lang.Class cl)
                                                             throws java.lang.Exception
This method returns a default constructor for the specified class. Despite appearences it can be used to construct objects of the specified type! of first non-serializable.

Parameters:
cl - The class to be used to get its constructor.
Returns:
The default constructor for the specified class.
Throws:
java.lang.Exception - If there is a problem.

stringable

public static boolean stringable(java.lang.Object o)
Returns true if the class of the object passed as parameter is stringable. In other words, returns true if the object can go easily to a string representation. Examples: Integer, Long, Character, Double, Class, String, etc. New version: June 2007.

Parameters:
o - The object to test.
Returns:
True if the object is stringable. False otherwise.

stringable

public static boolean stringable(java.lang.Class type)
Returns true if the class passed as parameter is stringable. In other words, returns true if objects of the class can go easily to a string representation. Examples: Integer, Long, Character, Double, Class, String, etc. New version: June 2007.

Parameters:
type - The class to test.
Returns:
True if the class is stringable. False otherwise.

stringable

public static boolean stringable(java.lang.String name)
Returns true if the class which name is passed as parameter is stringable. In other words, returns true if objects of the class can go easily to a string representation.

Parameters:
name - The name of the class to test.
Returns:
True if the class is stringable. False otherwise.

primitive

public static boolean primitive(java.lang.Class type)
This method returns true if the class passed as parameter is one of the valid primitive arrays classes supported by WOX.

Parameters:
type - The classs to test
Returns:
True if the class is in the array of primitives. False otherwise.