Class ProductParsers.EmptyProductParser

java.lang.Object
gov.nasa.jpl.aerie.json.ProductParsers.EmptyProductParser
All Implemented Interfaces:
JsonObjectParser<Unit>, JsonParser<Unit>
Enclosing class:
ProductParsers

public static final class ProductParsers.EmptyProductParser extends Object implements JsonObjectParser<Unit>
  • Method Details

    • getSchema

      public javax.json.JsonObject getSchema(SchemaCache anchors)
      Description copied from interface: JsonParser
      Produces a JSON Schema document fragment describing the format of JSON documents accepted by JsonParser.parse(JsonValue) and produced by JsonParser.unparse(T).

      The anchors parameter 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:
      getSchema in interface JsonParser<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

      public JsonParseResult<Unit> parse(javax.json.JsonValue json)
      Description copied from interface: JsonParser
      Attempts to parse a JSON document into the domain type T.

      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 the unparse method. See JsonParser.getSchema() for more on the relationships among these methods.

      Specified by:
      parse in interface JsonParser<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

      public javax.json.JsonObject unparse(Unit value)
      Description copied from interface: JsonParser
      Produces 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 by JsonParser.parse(JsonValue) into a value equal to the one given here.

      Specified by:
      unparse in interface JsonObjectParser<Unit>
      Specified by:
      unparse in interface JsonParser<Unit>
      Parameters:
      value - a domain value to encode in JSON
      Returns:
      a JSON document representing the given value
    • field

      public <S> ProductParsers.VariadicProductParser<S> field(String key, JsonParser<S> valueParser)
    • optionalField

      public <S> ProductParsers.VariadicProductParser<Optional<S>> optionalField(String key, JsonParser<S> valueParser)
    • rest

      public JsonObjectParser<Unit> rest()