Top Description Fields Constructors Methods
uk.ac.ed.ph.snuggletex.internal.util

public final Class ObjectUtilities

extends Object
Class Inheritance
Imports
java.lang.reflect.Array, .Method, java.util.Arrays

Some random "macros" for doing common Object-based tasks. (This is copied from ph-commons-util, though now has a couple of extra things in it.)
Author
David McKain
Version
$Revision$

Field Summary

Modifier and TypeField and Description
public static final Object[]
EMPTY_OBJECT_ARRAY

Shared instance of an empty array of Objects, which is sometimes useful!

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

String representation of the form className(p1=value,p2=value,...)
beanToString
(Object bean)

Utility method to create a simple String representation of a JavaBean Object by showing all properties p which can be called by getP() on the Object.

public static <E> E[]
concat(final E[] array1, final E[] array2, final Class<E> itemClass)

public static boolean
public static boolean

Returns:

true if either o1==o2 or (o1!=null and o1.equals(o2))
nullSafeEquals
(Object o1, Object o2)

Checks equality of two Objects, allowing the case where o1==o2==null to return true.

public static String
safeToString(Object object)

Convenience toString() method that can be applied safely to a null Object, yielding null.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EMPTY_OBJECT_ARRAYback to summary
public static final Object[] EMPTY_OBJECT_ARRAY

Shared instance of an empty array of Objects, which is sometimes useful!

Constructor Detail

ObjectUtilitiesback to summary
public ObjectUtilities()

Method Detail

beanToStringback to summary
public static String beanToString(Object bean)

Utility method to create a simple String representation of a JavaBean Object by showing all properties p which can be called by getP() on the Object.

Returns:String

String representation of the form className(p1=value,p2=value,...)

concatback to summary
public static <E> E[] concat(final E[] array1, final E[] array2, final Class<E> itemClass)
Annotations
@SuppressWarnings:unchecked
isNullOrEmptyback to summary
public static boolean isNullOrEmpty(Object[] array)
nullSafeEqualsback to summary
public static boolean nullSafeEquals(Object o1, Object o2)

Checks equality of two Objects, allowing the case where o1==o2==null to return true. The equals() method on o2 should be compatible with equality.

Returns:boolean

true if either o1==o2 or (o1!=null and o1.equals(o2))

safeToStringback to summary
public static String safeToString(Object object)

Convenience toString() method that can be applied safely to a null Object, yielding null.