JavaxJson { public static Value val(Object value) { if (value instanceof Cursor) { throw new IllegalArgumentException("dangling cursor for key: " + ((Cursor) value).getKey()); } else if (value instanceof HasValue) { return ((HasValue) value).toValue(); } else { return new Value(value); } } private  JavaxJson(); static boolean nonEmptyValue(final @Nullable JsonValue value); static boolean nonDefaultValue(final @Nullable JsonValue value, final @NotNull JsonValue defaultValue); static JsonValue wrap(final Object object); @SuppressWarnings("WeakerAccess") static Object unwrap(final JsonValue jsonValue); @SuppressWarnings("WeakerAccess") static Map<String, Object> unwrapObject(final JsonObject jsonObject); @SuppressWarnings("WeakerAccess") static List<Object> unwrapArray(final JsonArray jsonArray); static @NotNull JsonObject shallowMergeObjects(final @Nullable JsonObject base,
                                                          final @Nullable JsonObject overlay); static Value val(Object value); static Obj obj(final Key... keys); static Obj obj(final JsonObject jsonObject); static Obj obj(final Map<?, ?> map); static Key key(final String key, final Object value); static KeyCursor key(final String key); static Arr arr(Object... values); @SuppressWarnings("WeakerAccess") static Optional<JsonObject> optObject(final JsonObject json, final String key); @SuppressWarnings("WeakerAccess") static JsonObject objectOrEmpty(final JsonObject json, final String key); @SuppressWarnings("WeakerAccess") static Optional<JsonArray> optArray(final JsonObject json, final String key); static JsonArray arrayOrEmpty(final JsonObject json, final String key); static List<String> mapArrayOfStrings(final JsonArray jsonArray); static List<R> mapArrayOfStrings(final JsonArray jsonArray,
                                                final Function<String, R> mapFunction); static List<R> mapArrayOfStrings(final JsonArray jsonArray,
                                                final Function<String, R> mapFunction,
                                                final boolean discardNulls); static List<R> mapArrayOfObjects(final JsonArray jsonArray,
                                                final Function<JsonObject, R> mapFunction); static List<R> mapArrayOfObjects(final JsonArray jsonArray,
                                                final Function<JsonObject, R> mapFunction,
                                                final boolean discardNulls); static List<R> mapObjectValues(final JsonObject jsonObject,
                                              final BiFunction<String, JsonObject, R> mapBiFunction,
                                              final boolean discardNulls); @SuppressWarnings("WeakerAccess") static List<R> parseFromArray(final @NotNull JsonArray jsonArray,
                                             final @NotNull Fun.ThrowingFunction<String, R> parser,
                                             final @Nullable BiConsumer<String, Exception> errorConsumer); static boolean hasNonNull(final @NotNull JsonObject json, final String key); @SuppressWarnings("WeakerAccess")
    static final Function<JsonValue, String> JSON_VALUE_STRING; }
@Test public void testVal() { assertSame("null is NULL", val(null).get(), JsonObject.NULL); assertSame("null is NULL is NULL", val(val(null)).get(), JsonObject.NULL); assertTrue("Number is JsonNumber", val(1).get() instanceof JsonNumber); assertTrue("Number is JsonNumber is JsonNumber", val(val(1)).get() instanceof JsonNumber); assertTrue("String is JsonString", val("string").get() instanceof JsonString); assertTrue("String is JsonString is JsonString", val(val("string")).get() instanceof JsonString); assertSame("Boolean is JsonValue.TRUE or FALSE", val(true).get(), JsonValue.TRUE); assertSame("Boolean is JsonValue is JsonValue", val(val(true)).get(), JsonValue.TRUE); assertTrue("obj is JsonObject", val(obj()).get() instanceof JsonObject); assertTrue("obj is obj is JsonObject", val(val(obj())).get() instanceof JsonObject); assertTrue("JsonObject is JsonObject", val(obj().get()).get() instanceof JsonObject); assertTrue("JsonObject is JsonObject is JsonObject", val(val(obj().get())).get() instanceof JsonObject); assertTrue("arr is JsonArray", val(arr()).get() instanceof JsonArray); assertTrue("arr is arr is JsonArray", val(val(arr())).get() instanceof JsonArray); assertTrue("JsonArray is JsonArray", val(arr().get()).get() instanceof JsonArray); assertTrue("JsonArray is JsonArray is JsonArray", val(val(arr().get())).get() instanceof JsonArray); }