org.apache.axis.utils

Class ArrayUtil


public class ArrayUtil
extends java.lang.Object

Nested Class Summary

static class
ArrayUtil.NonConvertable

Field Summary

static ArrayUtil.NonConvertable
NON_CONVERTABLE
An object indicating that the conversion is not possible

Method Summary

static Object
convertArrayToObject(Object array, Class destClass)
Convert an array object of which type is T[] to ArrayOfT class.
static Object
convertObjectToArray(Object obj, Class arrayType)
Convert ArrayOfT to T[].
static int
getArrayDimension(Class arrayType)
Gets the dimension of arrayType
static boolean
isConvertable(Class clazz, Class arrayType)
Check if the clazz(perhaps ArrayOfT class) can be converted to T[].

Field Details

NON_CONVERTABLE

public static final ArrayUtil.NonConvertable NON_CONVERTABLE
An object indicating that the conversion is not possible

Method Details

convertArrayToObject

public static Object convertArrayToObject(Object array,
                                          Class destClass)
Convert an array object of which type is T[] to ArrayOfT class.
Parameters:
array - the array object
destClass - the destination class
Returns:
the object of type destClass if convertable, null if not.

convertObjectToArray

public static Object convertObjectToArray(Object obj,
                                          Class arrayType)
Convert ArrayOfT to T[].
Parameters:
obj - the object of type ArrayOfT to convert
arrayType - the destination array type
Returns:
returns the converted array object. If not convertable the original obj argument is returned. If the obj is not type of ArrayOfT or the value is null, null is returned.

getArrayDimension

public static int getArrayDimension(Class arrayType)
Gets the dimension of arrayType
Parameters:
arrayType - an array class
Returns:
the dimension

isConvertable

public static boolean isConvertable(Class clazz,
                                    Class arrayType)
Check if the clazz(perhaps ArrayOfT class) can be converted to T[].
Parameters:
clazz - a class of ArrayOfT
arrayType - an array class (T[])
Returns:
true if converable, false if not

Copyright B) 2005 Apache Web Services Project. All Rights Reserved.