Package org.oristool.lello
Class JavaInterop
java.lang.Object
org.oristool.lello.JavaInterop
Marshals and unmarshals data types and function calls between Lello and Java.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Class<?>
getWrapperType
(Class<?> t) Returns a class which can be used to represent the given class or primitive type.static Value
Converts a Java object to a Lello value.static Object
Converts a Lello value to a Java object.static Object
ValueToObject
(Value v, Class<?> a) Converts a Lello value to a Java object of a specific class.
-
Constructor Details
-
JavaInterop
public JavaInterop()
-
-
Method Details
-
ValueToObject
Converts a Lello value to a Java object.- Parameters:
v
- The Lello value.- Returns:
- The Java object.
-
ValueToObject
Converts a Lello value to a Java object of a specific class.The allowed classes are:
- Byte.class
- Short.class
- Integer.class
- Long.class
- Float.class
- Double.class
- String.class
- Boolean.class
- Parameters:
v
- The Lello value.a
- One of the classes listed above.- Returns:
- The Java object.
-
ObjectToValue
Converts a Java object to a Lello value.- Parameters:
o
- The Java object.- Returns:
- The Lello value.
-
getWrapperType
Returns a class which can be used to represent the given class or primitive type. Passing X.class will cause the method to return X.class; passing SomeWrapperClass.TYPE will cause the method to return SomeWrapperClass.class; in this example SomeWrapperClass is any of the Java wrapper classes for primitive types, such as Integer or Double.- Parameters:
t
- The class or primitive type.- Returns:
- If t is a class, t itself is returned; if it is a primitive type, its wrapper class is returned.
-