Package edu.tufts.hrilab.action.util
Class Utilities
java.lang.Object
edu.tufts.hrilab.action.util.Utilities
- 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectconvertToType(Class<?> clazz, Object value) Attempt to convert value to specified type.static SymbolcreateFOL(ActionBinding input) Deprecated.static Class<?>getArgumentType(String value) Attempt to infer argument types in action scripts when values are used directly in scripts without explicitly defining the argument type.static Class<?>Returns the Class object associated with the class or interface with the given string name.static booleanisAssignable(Class<?> fromClazz, Class<?> toClazz) Checks if a class can be assigned to another classstatic booleanChecks if value's toString is a valid boolean value (i.e., "true" or "false").static booleanisBooleanType(Class<?> clazz) Check is Class is a boolean type (primitive or non-primitive).static booleanChecks if value's toString is a float that ends "f" or "F" (e.g., 0.3f, 0.3F).static booleanChecks if value's toString is an integer with no decimal place.static booleanisIntegerType(Class<?> cls) static booleanisLocalVariable(Symbol value) Checks if a Symbol is an action script local variablestatic booleanisLocalVariable(String value) Checks if a string is an action script local variablestatic booleanChecks if value's toString is a long that ends "l" or "L" (e.g., 3l, or 3L).static booleanChecks if value's toString is an integer, long, float, or double.static booleanisNumericType(Class<?> clazz) Check is Class is a numeric type (primitive or non-primitive).static booleanisScriptVariable(Symbol value) Checks if a Symbol is an action script variable (of type Variable or starts with ! or ?) TODO: all Symbols that start with ! or ? and aren't of type Variable are being constructed incorrectly.static booleanisScriptVariable(String value) Checks if a string is an action script variablestatic <T extends Enum<?>>
TConvert string to enum type 
- 
Field Details
- 
log
protected static final org.slf4j.Logger log 
 - 
 - 
Constructor Details
- 
Utilities
public Utilities() 
 - 
 - 
Method Details
- 
getClass
Returns the Class object associated with the class or interface with the given string name. This is the same as Class.forName(), but with added support for Java primitives.- Parameters:
 type-- Returns:
 
 - 
isNumericType
Check is Class is a numeric type (primitive or non-primitive).- Parameters:
 clazz-- Returns:
 
 - 
isBooleanType
Check is Class is a boolean type (primitive or non-primitive).- Parameters:
 clazz-- Returns:
 
 - 
isNumeric
Checks if value's toString is an integer, long, float, or double.- Parameters:
 value-- Returns:
 
 - 
isBoolean
Checks if value's toString is a valid boolean value (i.e., "true" or "false").- Parameters:
 value-- Returns:
 
 - 
isInteger
Checks if value's toString is an integer with no decimal place.- Parameters:
 value-- Returns:
 
 - 
isLong
Checks if value's toString is a long that ends "l" or "L" (e.g., 3l, or 3L).- Parameters:
 value-- Returns:
 
 - 
isFloat
Checks if value's toString is a float that ends "f" or "F" (e.g., 0.3f, 0.3F).- Parameters:
 value-- Returns:
 
 - 
isScriptVariable
Checks if a string is an action script variable- Parameters:
 value- variable name- Returns:
 - true if string is variable (starts with ? or !)
 
 - 
isScriptVariable
Checks if a Symbol is an action script variable (of type Variable or starts with ! or ?) TODO: all Symbols that start with ! or ? and aren't of type Variable are being constructed incorrectly. those instances should be fixed and this method removed.- Parameters:
 value- symbol to check- Returns:
 - true if string is variable (starts with ? or !)
 
 - 
isLocalVariable
Checks if a Symbol is an action script local variable- Parameters:
 value- Symbol- Returns:
 - true if string is local variable (starts with !)
 
 - 
isLocalVariable
Checks if a string is an action script local variable- Parameters:
 value- variable name- Returns:
 - true if string is local variable (starts with !)
 
 - 
isIntegerType
- Returns:
 - true if class if of integer type
 
 - 
strToEnum
Convert string to enum type- Parameters:
 enumeration- enumstr- string to convert to enum type- Returns:
 
 - 
convertToType
Attempt to convert value to specified type.- Parameters:
 clazz- a Java class (for the time being at least)value-- Returns:
 
 - 
isAssignable
Checks if a class can be assigned to another class- Parameters:
 fromClazz-toClazz-- Returns:
 - true if clazz can be assigned to toClazz
 
 - 
getArgumentType
Attempt to infer argument types in action scripts when values are used directly in scripts without explicitly defining the argument type.- Parameters:
 value-- Returns:
 
 - 
createFOL
Deprecated.Create FOL instance from an ActionBinding's underlying value. Will return null if the ActionBinding's value is null. TODO: this functionality should probably be moved convertToType- Parameters:
 input-- Returns:
 
 
 -