org.apache.jdo.tck.util
Class ConversionHelper

java.lang.Object
  extended byorg.apache.jdo.tck.util.ConversionHelper

public class ConversionHelper
extends java.lang.Object

Provides consersion functionality.


Constructor Summary
ConversionHelper()
           
 
Method Summary
static java.util.Map arrayToMap(java.lang.Object[][] array)
          Converts the given array into a Map.
static java.lang.Object convertObjectArrayElements(java.lang.Object object)
          Recursively converts all elements of type Object[] Collection, or Map.
static java.lang.Object[] convertObjectArrayElements(java.lang.Object[] array)
          Recursively converts all elements of type Object[] in the given array and retuns that array.
static java.util.Collection convertsElementsOfTypeObjectArray(java.util.Collection collection)
          Returns a collection containing all elements in the given collection.
static java.util.Map convertsElementsOfTypeObjectArray(java.util.Map map)
          Returns a map containing all entries in the given map.
static java.lang.String[] toStringArray(java.lang.Object[] array)
          Converts the given array to a string array.
static java.util.Date toUtilDate(java.lang.String pattern, java.lang.String timezone, java.util.Locale locale, java.lang.String value)
          Converts the given value to a Date.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConversionHelper

public ConversionHelper()
Method Detail

toUtilDate

public static java.util.Date toUtilDate(java.lang.String pattern,
                                        java.lang.String timezone,
                                        java.util.Locale locale,
                                        java.lang.String value)
Converts the given value to a Date.

Parameters:
pattern - the pattern
timezone - the timezone
locale - the locale
value - the value
Returns:
the date
Throws:
javax.jdo.JDOFatalException - if the conversion fails

arrayToMap

public static java.util.Map arrayToMap(java.lang.Object[][] array)
Converts the given array into a Map. The first dimension represents the map entries, the second dimension holds the keys and values, e.g. { {"key1", "value1"}, {"key2", {"value2"} }.

Parameters:
array - the array
Returns:
the map

convertsElementsOfTypeObjectArray

public static java.util.Collection convertsElementsOfTypeObjectArray(java.util.Collection collection)
Returns a collection containing all elements in the given collection. Recursively converts all elements of type Object[] in the given collection to collections in the returned collection.

Parameters:
collection - the collection
Returns:
the converted collection

convertsElementsOfTypeObjectArray

public static java.util.Map convertsElementsOfTypeObjectArray(java.util.Map map)
Returns a map containing all entries in the given map. Recursively converts all entries having keys and/or values of type Object[] in the given map to collections in the returned map.

Parameters:
map - the map
Returns:
the converted map

convertObjectArrayElements

public static java.lang.Object convertObjectArrayElements(java.lang.Object object)
Recursively converts all elements of type Object[] Collection, or Map.

Parameters:
object - the object to convert
Returns:
the converted parameter
See Also:
convertObjectArrayElements(Object[]), convertsElementsOfTypeObjectArray(Collection), convertsElementsOfTypeObjectArray(Map)

convertObjectArrayElements

public static java.lang.Object[] convertObjectArrayElements(java.lang.Object[] array)
Recursively converts all elements of type Object[] in the given array and retuns that array.

Parameters:
array - the array
Returns:
the converted array

toStringArray

public static java.lang.String[] toStringArray(java.lang.Object[] array)
Converts the given array to a string array.

Parameters:
array - the object array
Returns:
the string array


Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.