/** * Parse the specified string representation of a value into its schema and value. * * @param value the string form of the value * @return the schema and value; never null, but whose schema and value may be null * @see #convertToString */ public static SchemaAndValue parseString(String value) { if (value == null) { return NULL_SCHEMA_AND_VALUE; } if (value.isEmpty()) { return new SchemaAndValue(Schema.STRING_SCHEMA, value); } Parser parser = new Parser(value); return parse(parser, false); }
throw new DataException("Unable to parse an empty array element: " + parser.original()); SchemaAndValue element = parse(parser, true); elementSchema = commonSchemaFor(elementSchema, element); result.add(element.value()); throw new DataException("Unable to parse a map entry has no key or value: " + parser.original()); SchemaAndValue key = parse(parser, true); if (key == null || key.value() == null) { throw new DataException("Map entry may not have a null key: " + parser.original()); throw new DataException("Map entry is missing '=': " + parser.original()); SchemaAndValue value = parse(parser, true); Object entryValue = value != null ? value.value() : null; result.put(key.value(), entryValue);