Class JavaHelper

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

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

    • of

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

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

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

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