|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.io.ArrayHandler
public final class ArrayHandler
This class enables the user to cast and clone arrays easily.
Constructor Summary | |
---|---|
ArrayHandler()
|
Method Summary | ||
---|---|---|
static
|
cast(T... o)
This method creates a new array of the super class of all elements of the given array and copies the elements. |
|
static
|
clone(T... t)
This method returns a deep copy of an array, i.e. for each element of the array the clone method will be invoked. |
|
static
|
getSuperClassOf(T... o)
This method returns the deepest class in the class hierarchy that is the class or a super class of all instances in the array. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ArrayHandler()
Method Detail |
---|
public static <T> Class getSuperClassOf(T... o)
o
- the array
public static <T> T[] cast(T... o)
Object[] o = { new UniformModel( alphabetContainer ), new UniformModel( alphabetContainer ) };
AbstractModel[] a = (AbstractModel[]) ArrayHandler.cast( o );
This should work fine, whileAbstractModel[] a = (AbstractModel[]) o;
o
- the array
getSuperClassOf(Object[])
,
XMLParser.extractStorableArrayForTag(StringBuffer, String, String)
public static <T extends Cloneable> T[] clone(T... t) throws CloneNotSupportedException
T
- the class that implements Cloneable
t
- the array
CloneNotSupportedException
- if an element could not be cloned.Cloneable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |