Class JavaHelper

java.lang.Object
org.kink_lang.kink.JavaHelper

public class JavaHelper extends Object
The helper of JavaVals.
  • Method Details

    • of

      public JavaVal of(@Nullable Object object, Class<?> staticType)
      Returns a java val.

      The object must be able to typed as staticType. Namely,

      • object is null and staticType is not a primitive type,
      • object is a boxed value and staticType is the corresponding primitive type,
      • or object is not null and staticType.isInstance(object) is true.
      Parameters:
      object - the nullable java object reference
      staticType - the static type.
      Returns:
      a java val.
      Throws:
      IllegalArgumentException - if object cannot be typed as staticType.
    • isTypable

      public static boolean isTypable(@Nullable Object object, Class<?> staticType)
      Returns true if the object is typable as staticType.
      Parameters:
      object - the object to test.
      staticType - the type to test.
      Returns:
      true if the object is typable as staticType.