public class Valid extends Object
Constructor and Description |
---|
Valid() |
Modifier and Type | Method and Description |
---|---|
static boolean[] |
copy(boolean[] arry) |
static byte[] |
copy(byte[] arry) |
static char[] |
copy(char[] arry) |
static double[] |
copy(double[] arry) |
static float[] |
copy(float[] arry) |
static int[] |
copy(int[] arry) |
static long[] |
copy(long[] arry) |
static short[] |
copy(short[] arry) |
static <T> T |
copy(T obj)
Convenience method to copy Cloneable objects.
|
static <T> T[] |
copy(T[] arry)
Convenience method to create a shallow copy of an array
if non null.
|
static <T extends Collection<E>,E> |
copyCol(T source,
T destination,
Class<E> type)
Convenience method to copy and type check all elements from the
source collection, into the destination collection.
|
static <T extends Map<K,V>,K,V> |
copyMap(T source,
T destination,
Class<K> key,
Class<V> val)
Convenience method to copy and type check all keys and values from
the source map, into the destination map.
|
static <T> T[] |
deepCopy(T[] arry)
Convenience method to perform a deep copy of an array containing
Cloneable objects
|
static <T> T |
hasClass(Class<T> type,
Object o) |
static <T> T |
isInstance(Class<T> type,
Object o) |
static <T> T |
notNull(T obj,
String message)
Convenience method to check that an object is non null.
|
static <T> T[] |
nullElement(T[] arry,
String message)
Checks all elements in an array for null values, if the arry parameter
is not null.
|
public static <T> T isInstance(Class<T> type, Object o) throws InvalidObjectException
InvalidObjectException
public static <T> T hasClass(Class<T> type, Object o) throws InvalidObjectException
InvalidObjectException
public static <T extends Collection<E>,E> T copyCol(T source, T destination, Class<E> type)
T
- Collection or subtype.E
- Element type.source
- Collection containing unchecked elements.destination
- Empty Collection to populate with checked elements.type
- ClassCastException
NullPointerException
- if any parameter is null.public static <T> T notNull(T obj, String message) throws InvalidObjectException
T
- obj
- message
- reason for exception.InvalidObjectException
- with a NullPointerException as its cause.public static <T> T[] nullElement(T[] arry, String message) throws InvalidObjectException
T
- arry
- the arraymessage
- the message for the InvalidObjectExceptionInvalidObjectException
- if array contains null elements.public static <T> T[] deepCopy(T[] arry) throws CloneNotSupportedException
T
- arry
- - may be null or contain null elements.CloneNotSupportedException
public static <T> T[] copy(T[] arry)
T
- typearry
- that will be cloned.public static byte[] copy(byte[] arry)
public static boolean[] copy(boolean[] arry)
public static char[] copy(char[] arry)
public static short[] copy(short[] arry)
public static int[] copy(int[] arry)
public static long[] copy(long[] arry)
public static double[] copy(double[] arry)
public static float[] copy(float[] arry)
public static <T> T copy(T obj) throws CloneNotSupportedException
T
- obj
- CloneNotSupportedException
public static <T extends Map<K,V>,K,V> T copyMap(T source, T destination, Class<K> key, Class<V> val)
T
- Map or subtype.K
- key type.V
- value type.source
- any map containing unchecked keys and values.destination
- a map into which checked values and keys are to be copied.key
- Class of key to type check.val
- Class of value to type check.ClassCastException
NullPointerException
- if any parameter is null.Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.