org.duelengine.duel
Class DuelData

java.lang.Object
  extended by org.duelengine.duel.DuelData

public final class DuelData
extends Object


Method Summary
static
<T> List<T>
asList(T... items)
          Builds a mutable List from a sequence of items
static Map<String,Object> asMap(Object... pairs)
          Builds a mutable Map from an interlaced sequence of key-value pairs
static boolean coerceBoolean(Object data)
          Coerces any Object to a JS-style Boolean
static Collection<?> coerceCollection(Object data)
          Coerces any Object to a JS-style Array (List)
static Map<?,?> coerceMap(Object data)
          Coerces any Object to a JS-style Object (Map)
static double coerceNumber(Object data)
          Coerces any Object to a JS-style Number (double)
static String coerceString(Object data)
          Coerces any Object to a JS-style String
static boolean containsKey(Object data, Object key)
          Treats the object as a Map and calls containsKey
static boolean isArray(Class<?> exprType)
           
static boolean isBoolean(Class<?> exprType)
           
static boolean isDate(Class<?> exprType)
           
static boolean isNumber(Class<?> exprType)
           
static boolean isPrimitive(Class<?> dataType)
           
static boolean isString(Class<?> exprType)
           
static String typeOf(Object data)
          Simulates the typeof operator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

asMap

public static Map<String,Object> asMap(Object... pairs)
Builds a mutable Map from an interlaced sequence of key-value pairs

Parameters:
pairs -
Returns:

asList

public static <T> List<T> asList(T... items)
Builds a mutable List from a sequence of items

Parameters:
items -
Returns:

isPrimitive

public static boolean isPrimitive(Class<?> dataType)

isBoolean

public static boolean isBoolean(Class<?> exprType)

isNumber

public static boolean isNumber(Class<?> exprType)

isString

public static boolean isString(Class<?> exprType)

isArray

public static boolean isArray(Class<?> exprType)

isDate

public static boolean isDate(Class<?> exprType)

typeOf

public static String typeOf(Object data)
Simulates the typeof operator

Parameters:
data -
Returns:
type string

coerceBoolean

public static boolean coerceBoolean(Object data)
Coerces any Object to a JS-style Boolean

Parameters:
data -
Returns:

coerceNumber

public static double coerceNumber(Object data)
Coerces any Object to a JS-style Number (double)

Parameters:
data -
Returns:

coerceString

public static String coerceString(Object data)
Coerces any Object to a JS-style String

Parameters:
data -
Returns:

coerceCollection

public static Collection<?> coerceCollection(Object data)
Coerces any Object to a JS-style Array (List)

Parameters:
data -
Returns:

coerceMap

public static Map<?,?> coerceMap(Object data)
Coerces any Object to a JS-style Object (Map)

Parameters:
data -
Returns:

containsKey

public static boolean containsKey(Object data,
                                  Object key)
Treats the object as a Map and calls containsKey

Parameters:
data -
key -
Returns:
true if data contains property or key


Copyright © 2011. All Rights Reserved.