org.mule.util
Class ArrayUtils

java.lang.Object
  extended byorg.apache.commons.lang.ArrayUtils
      extended byorg.mule.util.ArrayUtils

public class ArrayUtils
extends ArrayUtils

See Also:
Serialized Form

Constructor Summary
ArrayUtils()
           
 
Method Summary
static Object[] toArrayOfComponentType(Object[] objects, Class clazz)
          Creates a copy of the given array, but with the given Class as element type.
static String toString(Object array, int maxElements)
          Like #toString(Object) but considers at most maxElements values; overflow is indicated by an appended "[..]" ellipsis.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayUtils

public ArrayUtils()
Method Detail

toString

public static String toString(Object array,
                              int maxElements)
Like #toString(Object) but considers at most maxElements values; overflow is indicated by an appended "[..]" ellipsis.


toArrayOfComponentType

public static Object[] toArrayOfComponentType(Object[] objects,
                                              Class clazz)
Creates a copy of the given array, but with the given Class as element type. Useful for arrays of objects that implement multiple interfaces and a "typed view" onto these objects is required.

Parameters:
objects - the array of objects
clazz - the desired component type of the new array
Returns:
null when objects is null, or a new array containing the elements of the source array which is typed to the given clazz parameter. If clazz is already the component type of the source array, the source array is returned (i.e. no copy is created).
Throws:
IllegalArgumentException - if the clazz argument is null.
ArrayStoreException - if the elements in objects cannot be cast to clazz.


Copyright © 2003-2006 MuleSource Inc.. All Rights Reserved.