@Test public void testPrimitiveInference() { assertThat(ValueParserInferenceUtils.infeerPrimitiveParser(new JsonObject().put("type", "integer"))) .isSameAs(ValueParser.LONG_PARSER); assertThat(ValueParserInferenceUtils.infeerPrimitiveParser(new JsonObject().put("type", "number"))) .isSameAs(ValueParser.DOUBLE_PARSER); assertThat(ValueParserInferenceUtils.infeerPrimitiveParser(new JsonObject().put("type", "string"))) .isSameAs(ValueParser.NOOP_PARSER); assertThat(ValueParserInferenceUtils.infeerPrimitiveParser(new JsonObject().put("type", "boolean"))) .isSameAs(ValueParser.BOOLEAN_PARSER); }
public static ValueParser<String> infeerPrimitiveParser(Object schema) { if (schema == null) return null; if (schema instanceof Boolean) { return (boolean)schema ? NOOP_PARSER : null; } String type = ((JsonObject) schema).getString("type"); switch (type) { case "integer": return LONG_PARSER; case "number": return DOUBLE_PARSER; case "boolean": return BOOLEAN_PARSER; default: return NOOP_PARSER; } }
ValueParserInferenceUtils { public static ValueParser<String> infeerPrimitiveParser(Object schema) { if (schema == null) return null; if (schema instanceof Boolean) { return (boolean)schema ? NOOP_PARSER : null; } String type = ((JsonObject) schema).getString("type"); switch (type) { case "integer": return LONG_PARSER; case "number": return DOUBLE_PARSER; case "boolean": return BOOLEAN_PARSER; default: return NOOP_PARSER; } } }
ValueParserInferenceUtils { public static ValueParser<String> infeerPrimitiveParser(Object schema) { if (schema == null) return null; if (schema instanceof Boolean) { return (boolean)schema ? NOOP_PARSER : null; } String type = ((JsonObject) schema).getString("type"); switch (type) { case "integer": return LONG_PARSER; case "number": return DOUBLE_PARSER; case "boolean": return BOOLEAN_PARSER; default: return NOOP_PARSER; } }  }
ValueParserInferenceUtils { public static ValueParser<String> infeerPrimitiveParser(Object schema) { if (schema == null) return null; if (schema instanceof Boolean) { return (boolean)schema ? NOOP_PARSER : null; } String type = ((JsonObject) schema).getString("type"); switch (type) { case "integer": return LONG_PARSER; case "number": return DOUBLE_PARSER; case "boolean": return BOOLEAN_PARSER; default: return NOOP_PARSER; } }  static ValueParser<String> infeerPrimitiveParser(Object schema); static Map<String, ValueParser<String>> infeerPropertiesParsersForObjectSchema(Object s); static Map<Pattern, ValueParser<String>> infeerPatternPropertiesParsersForObjectSchema(Object s); static ValueParser<String> infeerAdditionalPropertiesParserForObjectSchema(Object s); static ValueParser<String> infeerItemsParserForArraySchema(Object s); static List<ValueParser<String>> infeerTupleParsersForArraySchema(Object s); static ValueParser<String> infeerAdditionalItemsParserForArraySchema(Object s); static Map<String, ValueParser<List<String>>> infeerPropertiesFormValueParserForObjectSchema(Object s); static Map<Pattern, ValueParser<List<String>>> infeerPatternPropertiesFormValueParserForObjectSchema(Object s); static ValueParser<List<String>> infeerAdditionalPropertiesFormValueParserForObjectSchema(Object s); }
ValueParserInferenceUtils { public static ValueParser<String> infeerPrimitiveParser(Object schema) { if (schema == null) return null; if (schema instanceof Boolean) { return (boolean)schema ? NOOP_PARSER : null; } String type = ((JsonObject) schema).getString("type"); switch (type) { case "integer": return LONG_PARSER; case "number": return DOUBLE_PARSER; case "boolean": return BOOLEAN_PARSER; default: return NOOP_PARSER; } }  static ValueParser<String> infeerPrimitiveParser(Object schema); static Map<String, ValueParser<String>> infeerPropertiesParsersForObjectSchema(Object s); static Map<Pattern, ValueParser<String>> infeerPatternPropertiesParsersForObjectSchema(Object s); static ValueParser<String> infeerAdditionalPropertiesParserForObjectSchema(Object s); static ValueParser<String> infeerItemsParserForArraySchema(Object s); static List<ValueParser<String>> infeerTupleParsersForArraySchema(Object s); static ValueParser<String> infeerAdditionalItemsParserForArraySchema(Object s); static Map<String, ValueParser<List<String>>> infeerPropertiesFormValueParserForObjectSchema(Object s); static Map<Pattern, ValueParser<List<String>>> infeerPatternPropertiesFormValueParserForObjectSchema(Object s); static ValueParser<List<String>> infeerAdditionalPropertiesFormValueParserForObjectSchema(Object s);  }