public interface JsonSerializer
Implementations of this service are expected to be provided by additional
integration modules, such as domino-jnx-jsonp
.
Modifier and Type | Field and Description |
---|---|
static Collection<String> |
DEFAULT_EXCLUDED_ITEMS |
static String |
PROP_META_ADDEDTOFILE |
static String |
PROP_META_CREATED |
static String |
PROP_META_LASTACCESSED |
static String |
PROP_META_LASTMODIFIED |
static String |
PROP_META_LASTMODIFIEDINFILE |
static String |
PROP_META_NOTECLASS |
static String |
PROP_META_NOTEID |
static String |
PROP_META_UNID |
static String |
PROP_METADATA |
static String |
PROP_RANGE_FROM |
static String |
PROP_RANGE_TO |
Modifier and Type | Method and Description |
---|---|
JsonSerializer |
booleanItemNames(Collection<String> booleanItemNames)
Sets the item names that should be considered boolean values when serialized to JSON.
|
JsonSerializer |
booleanTrueValues(Collection<Object> trueValues)
Sets the values used to determine
true and false when serializing items configured
via booleanItemNames(Collection) . |
static JsonSerializer |
createSerializer()
Constructs a new serializer using the first available JSON service.
|
JsonSerializer |
dateRangeFormat(DateRangeFormat format)
Sets the format for date/time range values.
|
JsonSerializer |
excludeItems(Collection<String> skippedItemNames)
Exclude items by name.
|
JsonSerializer |
excludeTypes(Collection<ItemDataType> excludedTypes)
Exclude item types.
|
JsonSerializer |
includeItems(Collection<String> includedItemNames)
Include only specific items by name.
|
JsonSerializer |
includeMetadata(boolean includeMetadata)
Sets whether to include a metadata object in the output JSON, using the "@meta" property.
|
JsonSerializer |
lowercaseProperties(boolean lowercaseProperties)
Sets whether property names in the emitted JSON should be lowercased.
|
Object |
toJson(Document doc)
Serializes the provided document as a JSON object using the implementation's
native JSON type.
|
default String |
toJsonString(Document doc)
Serializes the provided document as a JSON string.
|
static final Collection<String> DEFAULT_EXCLUDED_ITEMS
static final String PROP_METADATA
static final String PROP_META_NOTEID
static final String PROP_META_UNID
static final String PROP_META_CREATED
static final String PROP_META_LASTMODIFIED
static final String PROP_META_LASTMODIFIEDINFILE
static final String PROP_META_LASTACCESSED
static final String PROP_META_ADDEDTOFILE
static final String PROP_META_NOTECLASS
static final String PROP_RANGE_FROM
static final String PROP_RANGE_TO
static JsonSerializer createSerializer()
JsonSerializer
implementationIllegalStateException
- if there is no registered serializer implementationJsonSerializer excludeItems(Collection<String> skippedItemNames)
skippedItemNames
- a Collection
of case-insensitive item names, or null
to not
exclude any itemsJsonSerializer includeItems(Collection<String> includedItemNames)
Note: excludeItems(java.util.Collection<java.lang.String>)
is still applied if both are specified.
includedItemNames
- a Collection
of case-insensitive item names, or null
to not
include only specific itemsJsonSerializer excludeTypes(Collection<ItemDataType> excludedTypes)
excludedTypes
- a Collection
of item types to exclude, or null
to not exclude any
item typesJsonSerializer lowercaseProperties(boolean lowercaseProperties)
false
(the default),
emitted properties will match the capitalization of the first of each named item in the source
document.lowercaseProperties
- whether to lowercase property namesJsonSerializer includeMetadata(boolean includeMetadata)
false
by default.includeMetadata
- whether to include a document-metadata objectJsonSerializer booleanItemNames(Collection<String> booleanItemNames)
Items of type TEXT
, NUMBER
, and
RFC822_TEXT
, as well as
single-value items of type TEXT_LIST
or
NUMBER_RANGE
are evaluated for boolean conversion.
booleanItemNames
- the names of items to serialize as booleanJsonSerializer booleanTrueValues(Collection<Object> trueValues)
true
and false
when serializing items configured
via booleanItemNames(Collection)
.
All values not specified here will be considered false
.
trueValues
- a collection of objects to compare to resolve as true
JsonSerializer dateRangeFormat(DateRangeFormat format)
format
- the DateRangeFormat
type to useObject toJson(Document doc)
doc
- the document to serializeCopyright © 2019–2021 HCL. All rights reserved.