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 isArray(Class<?> exprType)
           
static boolean isBoolean(Class<?> exprType)
           
static boolean isNumber(Class<?> exprType)
           
static boolean isPrimitive(Class<?> dataType)
           
static boolean isString(Class<?> exprType)
           
 
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)

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:


Copyright © 2011. All Rights Reserved.