Package org.apache.bval.util
Class ObjectUtils
- java.lang.Object
- 
- org.apache.bval.util.ObjectUtils
 
- 
 public final class ObjectUtils extends Object 
- 
- 
Field SummaryFields Modifier and Type Field Description static Annotation[]EMPTY_ANNOTATION_ARRAYstatic Class<?>[]EMPTY_CLASS_ARRAYstatic String[]EMPTY_STRING_ARRAY
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T[]arrayAdd(T[] array, T objectToAdd)static booleanarrayContains(Object[] array, Object objectToFind)Checks if the object is in the given array.static <T> TdefaultIfNull(T object, T defaultValue)Returns a default value if the object passed isnull.static inthashCode(Object o)Get hashcode ofo, taking into account array values.static intindexOf(Object[] array, Object objectToFind)static booleanisEmptyArray(Object array)
 
- 
- 
- 
Field Detail- 
EMPTY_CLASS_ARRAYpublic static final Class<?>[] EMPTY_CLASS_ARRAY 
 - 
EMPTY_STRING_ARRAYpublic static final String[] EMPTY_STRING_ARRAY 
 - 
EMPTY_ANNOTATION_ARRAYpublic static final Annotation[] EMPTY_ANNOTATION_ARRAY 
 
- 
 - 
Method Detail- 
defaultIfNullpublic static <T> T defaultIfNull(T object, T defaultValue)Returns a default value if the object passed is null.ObjectUtils.defaultIfNull(null, null) = null ObjectUtils.defaultIfNull(null, "") = "" ObjectUtils.defaultIfNull(null, "zz") = "zz" ObjectUtils.defaultIfNull("abc", *) = "abc" ObjectUtils.defaultIfNull(Boolean.TRUE, *) = Boolean.TRUE- Type Parameters:
- T- the type of the object
- Parameters:
- object- the- Objectto test, may be- null
- defaultValue- the default value to return, may be- null
- Returns:
- objectif it is not- null, defaultValue otherwise
 
 - 
isEmptyArraypublic static boolean isEmptyArray(Object array) 
 - 
arrayContainspublic static boolean arrayContains(Object[] array, Object objectToFind) Checks if the object is in the given array. The method returns falseif anullarray is passed in.- Parameters:
- array- the array to search through
- objectToFind- the object to find
- Returns:
- trueif the array contains the object
 
 - 
arrayAddpublic static <T> T[] arrayAdd(T[] array, T objectToAdd)
 - 
hashCodepublic static int hashCode(Object o) Get hashcode ofo, taking into account array values.- Parameters:
- o-
- Returns:
- int
- See Also:
- Arrays,- Objects.hashCode(Object)
 
 
- 
 
-