Field
formatting expressions that allow for formatting a
Field
when embedding it in SQLDataType.JSON
,
SQLDataType.JSONB
, or SQLDataType.XML
.
Implementations should ensure:
- That
FormatterContext.multiset()
vs non-multiset specific behaviour is distinguished, if necessary - That
NULL
behaviour is maintained.
Comparison to other API types
Unlike Formattable
, which talks about formatting data to JSON, XML,
and other text types in the client using Java, the Formatter
takes
care of doing this directly in SQL.
Unlike Converter
, the formatting affects how the RDBMS embeds the
value into a JSON or XML datastructure before sending the data to
the client. A Converter
is applied only after fetching data from
JDBC.
- Author:
- Lukas Eder
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Format theFormatterContext.field()
expression to embed it in aSQLDataType.JSON
context.void
Format theFormatterContext.field()
expression to embed it in aSQLDataType.JSONB
context.void
Format theFormatterContext.field()
expression to embed it in aSQLDataType.XML
context.
-
Method Details
-
formatJSON
Format theFormatterContext.field()
expression to embed it in aSQLDataType.JSON
context.If applicable, a
Binding
should place the resulting expression in theFormatterContext.field(Field)
out parameter. If the out parameter is left untouched, then no JSON specific formatting is applied to theFormatterContext.field()
expression.The
FormatterContext.multiset()
flag indicates that the JSON context is from aNestedCollectionEmulation.JSON
emulation for aDSL.multiset(TableLike)
expression. -
formatJSONB
Format theFormatterContext.field()
expression to embed it in aSQLDataType.JSONB
context.If applicable, a
Binding
should place the resulting expression in theFormatterContext.field(Field)
out parameter. If the out parameter is left untouched, then no JSONB specific formatting is applied to theFormatterContext.field()
expression.The
FormatterContext.multiset()
flag indicates that the JSONB context is from aNestedCollectionEmulation.JSONB
emulation for aDSL.multiset(TableLike)
expression. -
formatXML
Format theFormatterContext.field()
expression to embed it in aSQLDataType.XML
context.If applicable, a
Binding
should place the resulting expression in theFormatterContext.field(Field)
out parameter. If the out parameter is left untouched, then no XML specific formatting is applied to theFormatterContext.field()
expression.The
FormatterContext.multiset()
flag indicates that the XML context is from aNestedCollectionEmulation.XML
emulation for aDSL.multiset(TableLike)
expression.
-