Class JavaHelper

    • Method Detail

      • 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.
        object - the nullable java object reference
        staticType - the static type.
        a java val.
        IllegalArgumentException - if object cannot be typed as staticType.
      • isTypable

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