Language Specs
Type Coercion
type coersion, with some well defined rules, so you are not limited to the types which the method wants. Intead, it will take a variety of types. this is the code for the type conversion. It defines solidly which types can be converted into which types.
// Integers are convertible to floats
addCoercer(Integer.class, Float.class, new FloatFromInt()); addCoercer(int.class, float.class, new FloatFromInt());
// Floats are convertible to ints, with loss of precision
addCoercer(Float.class, Integer.class, new IntFromFloat()); addCoercer(float.class, int.class, new IntFromFloat());
// Unboxing conversion
addCoercer(Float.class, float.class, new floatFromFloat()); addCoercer(Integer.class, int.class, new intFromInt()); addCoercer(Double.class, double.class, new doubleFromDouble()); addCoercer(Boolean.class, boolean.class, new boolFromBoolean());
// Symbol and strings are bi-directionally interchangeable
addCoercer(String.class, Symbol.class, new SymbolFromString()); addCoercer(Symbol.class, String.class, new StringFromSymbol());
// Object[] arrays convert into the various desired special classes
addCoercer(Object[].class, Vector3f.class, new Vector3fFromObjectArray()); addCoercer(Object[].class, Color3f.class, new Color3fFromObjectArray()); addCoercer(Object[].class, Quat4f.class, new Quat4fFromObjectArray());
// HashMaps convert into the various desired special classes
addCoercer(HashMap.class, Vector3f.class, new Vector3fFromHashMap()); addCoercer(HashMap.class, Color3f.class, new Color3fFromHashMap()); addCoercer(HashMap.class, Quat4f.class, new Quat4fFromHashMap());
// various conversions between the specialized vector classes
addCoercer(Object[].class, Color3f.class, new Color3fFromObjectArray()); addCoercer(Vector4f.class, Quat4f.class, new Quat4fFromVec4f()); addCoercer(Vector3f.class, Color3f.class, new Color3fFromVec3f());
// strings and JSON are bi-directionally convertible addCoercer(String.class, JsonNode.class, new JsonNodeFromString()); addCoercer(JsonNode.class, String.class, new StringFromJsonNode());
// Strings and UUIDs are bi-directionally convertible
addCoercer(String.class, UUID.class, new UUIDFromString()); addCoercer(UUID.class, String.class, new StringFromUUID());
// nodes can be converted into instanceID's
addCoercer(BaseNodeCored.class, UUID.class, new InstanceIDFromBaseNodeCored()); addCoercer(DynamicPropertyNode.class, UUID.class, new InstanceIDFromBaseNodeCored());
//quat4f can be converted to euler
addCoercer(Quat4f.class, Euler.class, new EulerFromQuat4f()); addCoercer(Vector4f.class, Euler.class, new EulerFromVector4f()); addCoercer(Vector3f.class, Euler.class, new EulerFromVector3f());
}