Class ProductParsers.EmptyProductParser
- All Implemented Interfaces:
JsonObjectParser<Unit>,JsonParser<Unit>
- Enclosing class:
ProductParsers
-
Method Summary
Modifier and TypeMethodDescriptionfield(String key, JsonParser<S> valueParser) javax.json.JsonObjectgetSchema(SchemaCache anchors) Produces a JSON Schema document fragment describing the format of JSON documents accepted byJsonParser.parse(JsonValue)and produced byJsonParser.unparse(T).optionalField(String key, JsonParser<S> valueParser) parse(javax.json.JsonValue json) Attempts to parse a JSON document into the domain typeT.rest()javax.json.JsonObjectProduces a JSON document representing the given value.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface gov.nasa.jpl.aerie.json.JsonObjectParser
map, mapMethods inherited from interface gov.nasa.jpl.aerie.json.JsonParser
getSchema
-
Method Details
-
getSchema
Description copied from interface:JsonParserProduces a JSON Schema document fragment describing the format of JSON documents accepted byJsonParser.parse(JsonValue)and produced byJsonParser.unparse(T).The
anchorsparameter is an accumulator for visited sub-parsers, tracking a JSON Schema identifier for each. An implementations may add to the set of anchors, but may not alter or remove an existing anchor, and must not add itself. This allows an arbitrary caller to make the choice of whether to inline a definition at all use-sites or reference a single copy.This method is primarily meant for use from other parsers. To generate a top-level schema for a root-level parser, use
JsonParser.getSchema().- Specified by:
getSchemain interfaceJsonParser<Unit>- Parameters:
anchors- a mutable collection of JSON Schema identifiers for previously-visited parsers- Returns:
- a JSON Schema document describing the format of JSON documents supported by this parser.
-
parse
Description copied from interface:JsonParserAttempts to parse a JSON document into the domain typeT.This method must successfully parse any document generated by
JsonParser.unparse(T), and the resulting domain value must be equal to the one that produced that document. No guarantees are made for documents not generated by theunparsemethod. SeeJsonParser.getSchema()for more on the relationships among these methods.- Specified by:
parsein interfaceJsonParser<Unit>- Parameters:
json- the JSON document to parse into a domain value- Returns:
- a wrapped domain value if parsing succeeds, or failure information otherwise
-
unparse
Description copied from interface:JsonParserProduces a JSON document representing the given value.The document produced by this method must validate against the schema returned by
JsonParser.getSchema(), and must be parsed successfully byJsonParser.parse(JsonValue)into a value equal to the one given here.- Specified by:
unparsein interfaceJsonObjectParser<Unit>- Specified by:
unparsein interfaceJsonParser<Unit>- Parameters:
value- a domain value to encode in JSON- Returns:
- a JSON document representing the given value
-
field
-
optionalField
public <S> ProductParsers.VariadicProductParser<Optional<S>> optionalField(String key, JsonParser<S> valueParser) -
rest
-