| java.lang.Object org.apache.turbine.util.ObjectUtils
Method Summary | |
public static void | addOnce(List l, Object o) Adds an object to a list, making sure the object is in the
list only once. | public static Object | deserialize(byte[] objectData) Deserializes a single object from an array of bytes.
Parameters: objectData - The serialized object. | public static boolean | equals(Object o1, Object o2) Compares two Objects, returns true if their values are the
same. | public static Object | isNull(Object o, Object dflt) Returns a default value if the object passed is null.
Parameters: o - The object to test. Parameters: dflt - The default value to return. | final public static void | safeAddToHashtable(Hashtable hash, Object key, Object value) Nice method for adding data to a Hashtable in such a way
as to not get NPE's. | public static byte[] | serializeHashtable(Hashtable hash) Converts a hashtable to a byte array for storage/serialization.
Parameters: hash - The Hashtable to convert. |
addOnce | public static void addOnce(List l, Object o)(Code) | | Adds an object to a list, making sure the object is in the
list only once.
Parameters: l - The list. Parameters: o - The object. |
deserialize | public static Object deserialize(byte[] objectData)(Code) | | Deserializes a single object from an array of bytes.
Parameters: objectData - The serialized object. The deserialized object, or null on failure. |
equals | public static boolean equals(Object o1, Object o2)(Code) | | Compares two Objects, returns true if their values are the
same. It checks for null values prior to an o1.equals(o2)
check
Parameters: o1 - The first object. Parameters: o2 - The second object. True if the values of both xstrings are the same. |
isNull | public static Object isNull(Object o, Object dflt)(Code) | | Returns a default value if the object passed is null.
Parameters: o - The object to test. Parameters: dflt - The default value to return. The object o if it is not null, dflt otherwise. |
safeAddToHashtable | final public static void safeAddToHashtable(Hashtable hash, Object key, Object value) throws NullPointerException(Code) | | Nice method for adding data to a Hashtable in such a way
as to not get NPE's. The point being that if the
value is null, Hashtable.put() will throw an exception.
That blows in the case of this class cause you may want to
essentially treat put("Not Null", null ) == put("Not Null", "")
We will still throw a NPE if the key is null cause that should
never happen.
|
serializeHashtable | public static byte[] serializeHashtable(Hashtable hash) throws Exception(Code) | | Converts a hashtable to a byte array for storage/serialization.
Parameters: hash - The Hashtable to convert. A byte[] with the converted Hashtable. exception: Exception - A generic exception. |
|
|