org.lateralnz.common.util
Class ObjectUtils

java.lang.Object
  extended by org.lateralnz.common.util.ObjectUtils
All Implemented Interfaces:
Constants

public class ObjectUtils
extends java.lang.Object
implements Constants

various utility functions for object handling

 
 
 


Field Summary
 
Fields inherited from interface org.lateralnz.common.util.Constants
AMPERSAND, AND, APPLICATION_X_WWW_FORM_URLENCODED, ASTERISK, AT, BACK_SLASH, CHAR_LEFT_CHEV, CHAR_RIGHT_CHEV, COLON, COMMA, CRLF, DASH, DELETE, DOLLAR, DOT, DOT_CLASS, DOT_JAVA, EIGHT, EMPTY, EQUALS, FALSE, FILE_SEPARATOR, FIVE, FORWARD_SLASH, FOUR, FULLSTOP, HASH, HAT, INSERT, LEFT_BRACE, LEFT_BRACKET, LEFT_CHEV, MAX_LEN_APPCODE, MAX_LEN_APPGROUP, MAX_LEN_MSGCODE, MAX_LEN_MSGTEXT, MINUS_ONE, N, NEWLINE, NINE, NO, NULL_STRING, OFF, ON, ONE, ONE_DAY, ONE_HOUR, ONE_MINUTE, ONE_WEEK, PATH_SEPARATOR, PERCENT, PIPE, PLUS, QUESTION_MARK, QUOTE, REQUIRED, REQUIRES_NEW, RETURN, RIGHT_BRACE, RIGHT_BRACKET, RIGHT_CHEV, SELECT, SEMICOLON, SEVEN, SINGLE_QUOTE, SIX, SPACE, SQ_LEFT_BRACKET, SQ_RIGHT_BRACKET, SUPPORTS, TEXT_HTML, TEXT_PLAIN, TEXT_XML, THREE, TRUE, TWO, UNDERSCORE, UPDATE, UTF_8, Y, YES, ZERO
 
Constructor Summary
ObjectUtils()
           
 
Method Summary
static java.lang.Object coercePrimitive(java.lang.String s, java.lang.Class c)
          resolve a string (specified as a primitive) to a object wrapper (i.e.
static boolean containsObject(java.lang.Object[] src, java.lang.Object match)
          return true if an object is found in an array
static java.lang.Object copyArray(java.lang.Object[] src, int newsize)
          create a new array of a specified size copying the contents of a specified array
static java.lang.Object deserialize(byte[] b)
          deserialize an array of bytes into the original object
static java.lang.Class getClass(java.lang.String classname)
          get a class based upon the specified classname (this method will correctly resolve primitives).
static java.lang.String getMD5Signature(java.lang.Class c)
          get an md5 signature for a class based upon the methods (return type/name/parameters)
static java.lang.String getParameterType(java.lang.Class c)
          return a class as a Java string
static boolean isPrimitive(java.lang.String classname)
          return true if the specified string classname is a primitive.
static void loadList(java.lang.Object[] src, java.util.List dest)
          load a list with the contents of an array
static byte[] serialize(java.lang.Object obj)
          serialize an object into an array of bytes
static java.lang.String toString(java.util.List objectList)
          generic function to iterate through a list of objects and return a concatenated 'toString' of them
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectUtils

public ObjectUtils()
Method Detail

coercePrimitive

public static final java.lang.Object coercePrimitive(java.lang.String s,
                                                     java.lang.Class c)
resolve a string (specified as a primitive) to a object wrapper (i.e. turn a String into a Byte based upon a specified byte.class) given its primitive class


containsObject

public static final boolean containsObject(java.lang.Object[] src,
                                           java.lang.Object match)
return true if an object is found in an array


copyArray

public static final java.lang.Object copyArray(java.lang.Object[] src,
                                               int newsize)
create a new array of a specified size copying the contents of a specified array


getClass

public static final java.lang.Class getClass(java.lang.String classname)
                                      throws java.lang.Exception
get a class based upon the specified classname (this method will correctly resolve primitives).

Throws:
java.lang.Exception

getParameterType

public static final java.lang.String getParameterType(java.lang.Class c)
return a class as a Java string


getMD5Signature

public static final java.lang.String getMD5Signature(java.lang.Class c)
                                              throws java.lang.Exception
get an md5 signature for a class based upon the methods (return type/name/parameters)

Throws:
java.lang.Exception

deserialize

public static final java.lang.Object deserialize(byte[] b)
                                          throws java.io.IOException,
                                                 java.lang.ClassNotFoundException
deserialize an array of bytes into the original object

Throws:
java.io.IOException
java.lang.ClassNotFoundException

isPrimitive

public static final boolean isPrimitive(java.lang.String classname)
return true if the specified string classname is a primitive. This returns true if classname is "byte", "short", "char", "int", etc.


loadList

public static final void loadList(java.lang.Object[] src,
                                  java.util.List dest)
load a list with the contents of an array


serialize

public static final byte[] serialize(java.lang.Object obj)
                              throws java.io.IOException
serialize an object into an array of bytes

Throws:
java.io.IOException

toString

public static final java.lang.String toString(java.util.List objectList)
generic function to iterate through a list of objects and return a concatenated 'toString' of them