@Test public void wrapShouldReturnJsonNumberWhenBigInteger() throws Exception { final JsonValue actual = JsonValue.wrap(BigInteger.ONE); assertThat(actual) .isJsonNumber() .hasType(TypeName.get(BigInteger.class)) .hasValue(BigInteger.ONE); }
@Nonnull @CheckReturnValue public static JsonValue wrap(@Nullable Object value) { return Stream.of(ValueType.values()) .filter(type -> type.isAcceptable(value)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Unsupported type of value(" + value + ")")) .wrap(value); }
JsonValue { @Nonnull @CheckReturnValue public static JsonValue wrap(@Nullable Object value) { return Stream.of(ValueType.values()) .filter(type -> type.isAcceptable(value)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Unsupported type of value(" + value + ")")) .wrap(value); } }
JsonValue { @Nonnull @CheckReturnValue public static JsonValue wrap(@Nullable Object value) { return Stream.of(ValueType.values()) .filter(type -> type.isAcceptable(value)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Unsupported type of value(" + value + ")")) .wrap(value); }  }
JsonValue { @Nonnull @CheckReturnValue public static JsonValue wrap(@Nullable Object value) { return Stream.of(ValueType.values()) .filter(type -> type.isAcceptable(value)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Unsupported type of value(" + value + ")")) .wrap(value); }  @Nonnull @CheckReturnValue static JsonValue wrap(@Nullable Object value); @Nonnull abstract TypeName getType(); abstract Object getValue(); @Override String toString(); @CheckReturnValue boolean isNull(); @CheckReturnValue boolean isBoolean(); @CheckReturnValue boolean isNumber(); @CheckReturnValue boolean isString(); @CheckReturnValue boolean isArray(); @CheckReturnValue boolean isObject(); @Nonnull @CheckReturnValue JsonNull asNull(); @Nonnull @CheckReturnValue JsonBoolean asBoolean(); @Nonnull @CheckReturnValue JsonNumber asNumber(); @Nonnull @CheckReturnValue JsonString asString(); @Nonnull @CheckReturnValue JsonArray asArray(); @Nonnull @CheckReturnValue JsonObject asObject(); }
JsonValue { @Nonnull @CheckReturnValue public static JsonValue wrap(@Nullable Object value) { return Stream.of(ValueType.values()) .filter(type -> type.isAcceptable(value)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Unsupported type of value(" + value + ")")) .wrap(value); }  @Nonnull @CheckReturnValue static JsonValue wrap(@Nullable Object value); @Nonnull abstract TypeName getType(); abstract Object getValue(); @Override String toString(); @CheckReturnValue boolean isNull(); @CheckReturnValue boolean isBoolean(); @CheckReturnValue boolean isNumber(); @CheckReturnValue boolean isString(); @CheckReturnValue boolean isArray(); @CheckReturnValue boolean isObject(); @Nonnull @CheckReturnValue JsonNull asNull(); @Nonnull @CheckReturnValue JsonBoolean asBoolean(); @Nonnull @CheckReturnValue JsonNumber asNumber(); @Nonnull @CheckReturnValue JsonString asString(); @Nonnull @CheckReturnValue JsonArray asArray(); @Nonnull @CheckReturnValue JsonObject asObject();  }