Interface JsonObjectParser<T>
- All Superinterfaces:
JsonParser<T>
- All Known Implementing Classes:
ProductParsers.EmptyProductParser,ProductParsers.VariadicProductParser
-
Method Summary
Modifier and TypeMethodDescriptiondefault <S> JsonObjectParser<S> Adapts this parser losslessly from one domain type to another with a two-way conversion.default <S> JsonObjectParser<S> Adapts this parser losslessly from one domain type to another.javax.json.JsonObjectProduces a JSON document representing the given value.Methods inherited from interface gov.nasa.jpl.aerie.json.JsonParser
getSchema, getSchema, parse
-
Method Details
-
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 interfaceJsonParser<T>- Parameters:
value- a domain value to encode in JSON- Returns:
- a JSON document representing the given value
-
map
Description copied from interface:JsonParserAdapts this parser losslessly from one domain type to another with a two-way conversion.The data types most convenient for building parsers are not always the ones we actually want to end up with in the business domain. This method turns a parser that works with one (parsing-relevant) type into a parser that works with another (domain-relevant) type (typically the domain-relevant one).
To do this, we need to know the precise relationship between the two types. Specifically, we need a way to turn any value of one into a value of the other, and vice versa. This is captured by the
Convertparameter, which provides a pair of forward and backward transformations.- Specified by:
mapin interfaceJsonParser<T>- Type Parameters:
S- the new domain type to convert to- Parameters:
transform- the reversible transformation faithfully mapping betweenTobjects andSobjects- Returns:
- a parser supporting the same JSON documents as this parser, but for domain type
S.
-
map
Description copied from interface:JsonParserAdapts this parser losslessly from one domain type to another.The data types most convenient for building parsers are not always the ones we actually want to end up with in the business domain. This method turns a parser that works with one (parsing-relevant) type into a parser that works with another (domain-relevant) type (typically the domain-relevant one).
To do this, we need to know the precise relationship between the two types. Specifically, we need a way to turn any value of one into a value of the other, and vice versa.
- Specified by:
mapin interfaceJsonParser<T>- Type Parameters:
S- the new domain type to convert to- Parameters:
from- an infallible transformation from the source type to the target typeto- an infallible transformation to the source type from the target type- Returns:
- a parser supporting the same JSON documents as this parser, but for domain type
S.
-