Class SerializationContext<T>
- Type Parameters:
T- Type of the value
- All Implemented Interfaces:
JsonLdContext
This means the value being serialized, and optionally the target JSON-LD term identifier and field.
Note that term and field may not always be available, e.g., when a collection element is being serialized, neither is set.
This class also provides access to the JSON-LD context (if it is used). However, note that for selected serialization methods the context may be just a stub with no bearing on the serialization output.
-
Constructor Summary
ConstructorsConstructorDescriptionSerializationContext(Field field, T value, JsonLdContext jsonLdContext) SerializationContext(String term, Field field, T value, JsonLdContext jsonLdContext) SerializationContext(String term, T value, JsonLdContext jsonLdContext) SerializationContext(T value, JsonLdContext jsonLdContext) -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns anObjectNoderepresenting this context.getField()getMappedTerm(String iri) Gets the term mapped to the specified identifier (if it exists).getTerm()getTermMapping(String term) Gets the mapping for the specified term (if it exists).getValue()inthashCode()booleanhasTermMapping(String term) Checks whether this JSON-LD context contains mapping for the specified term.booleanChecks whether this particular JSON-LD context is empty.voidregisterTermMapping(String term, ObjectNode mappedNode) Registers the specified term mapping in this context.voidregisterTermMapping(String term, String iri) Registers the specified term mapping in this context.voidsetJsonLdContext(JsonLdContext jsonLdContext)
-
Constructor Details
-
SerializationContext
-
SerializationContext
-
SerializationContext
-
SerializationContext
-
-
Method Details
-
getTerm
-
getField
-
getFieldName
-
getValue
-
getJsonLdContext
-
setJsonLdContext
-
registerTermMapping
Description copied from interface:JsonLdContextRegisters the specified term mapping in this context.Typically, the
termwould be Java attribute (field) name andiriwould be the IRI to which this field is mapped.- Specified by:
registerTermMappingin interfaceJsonLdContext- Parameters:
term- Mapped termiri- IRI to which the term is mapped
-
registerTermMapping
Description copied from interface:JsonLdContextRegisters the specified term mapping in this context.Compared to
JsonLdContext.registerTermMapping(String, String), this method allows registering more complex mapping like language containers or typed literals.- Specified by:
registerTermMappingin interfaceJsonLdContext- Parameters:
term- Mapped termmappedNode- Node to which the term is mapped
-
getTermMapping
Description copied from interface:JsonLdContextGets the mapping for the specified term (if it exists).- Specified by:
getTermMappingin interfaceJsonLdContext- Parameters:
term- Term to get mapping for- Returns:
- Optional mapping node
-
hasTermMapping
Description copied from interface:JsonLdContextChecks whether this JSON-LD context contains mapping for the specified term.- Specified by:
hasTermMappingin interfaceJsonLdContext- Parameters:
term- Term to search mapping for- Returns:
trueif a mapping is already defined for the term,falseotherwise
-
getMappedTerm
Description copied from interface:JsonLdContextGets the term mapped to the specified identifier (if it exists).This method checks term mapping in this context and finds a term that is mapped to the specified identifier.
- Specified by:
getMappedTermin interfaceJsonLdContext- Parameters:
iri- Identifier the term is mapped to- Returns:
- Optional mapped term, empty optional if there is no such term mapping
-
isCurrentEmpty
public boolean isCurrentEmpty()Description copied from interface:JsonLdContextChecks whether this particular JSON-LD context is empty.Term mapping inherited from any parent contexts is not considered.
- Specified by:
isCurrentEmptyin interfaceJsonLdContext- Returns:
trueif this context is empty,falseotherwise
-
getContextNode
Description copied from interface:JsonLdContextReturns anObjectNoderepresenting this context.The result can thus be added to serialization output.
- Specified by:
getContextNodein interfaceJsonLdContext- Returns:
JsonNodewith registered mappings
-
equals
-
hashCode
public int hashCode()
-