Class JavaInterop

java.lang.Object
org.oristool.lello.JavaInterop

public class JavaInterop extends Object
Marshals and unmarshals data types and function calls between Lello and Java.
  • Constructor Details

    • JavaInterop

      public JavaInterop()
  • Method Details

    • ValueToObject

      public static Object ValueToObject(Value v)
      Converts a Lello value to a Java object.
      Parameters:
      v - The Lello value.
      Returns:
      The Java object.
    • ValueToObject

      public static Object ValueToObject(Value v, Class<?> a)
      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

      public static Value ObjectToValue(Object o)
      Converts a Java object to a Lello value.
      Parameters:
      o - The Java object.
      Returns:
      The Lello value.
    • getWrapperType

      public static Class<?> getWrapperType(Class<?> t)
      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.