Package com.evolveum.midpoint.prism
Interface PrismSerializer<T>
-
- All Known Implementing Classes:
PrismSerializerImpl
public interface PrismSerializer<T>
Takes care of serializing prism objects and other beans, i.e. converts java form to lexical representation (XML/JSON/YAML strings, DOM tree) or intermediate one (XNode). General post-conditions: 1. All type QNames will be resolvable (i.e. they will be part of static schema) - TODO think again about this; think also about allowing 'system-wide' parts of dynamic schema ... 2. If root(..) is configured, it will be set regardless of the object type and content. 3. ... TODO ...
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull PrismSerializer<T>
context(@Nullable SerializationContext context)
Sets the context for the serialization operation, containing e.g.@NotNull PrismSerializer<T>
definition(ItemDefinition itemDefinition)
Sets the item definition to be used during serialization.@NotNull PrismSerializer<T>
itemsToSkip(Collection<? extends QName> itemNames)
These items will be skipped during serialization.@NotNull PrismSerializer<T>
options(@Nullable SerializationOptions options)
Sets the serialization options (part of the context).@NotNull PrismSerializer<T>
root(QName elementName)
Sets the name of the root element.T
serialize(@NotNull Item<?,?> item)
Serializes given prism item.T
serialize(@NotNull PrismValue value)
Serializes given prism value (property, reference, or container).T
serialize(@NotNull PrismValue value, QName rootName)
Serializes given prism value (property, reference, or container).T
serialize(@NotNull RootXNode xnode)
T
serialize(javax.xml.bind.JAXBElement<?> value)
T
serializeAnyData(Object value)
T
serializeAnyData(Object value, QName rootName)
T
serializeObjects(@NotNull List<PrismObject<?>> objects)
T
serializeRealValue(Object value)
T
serializeRealValue(Object value, QName rootName)
-
-
-
Method Detail
-
root
@NotNull @NotNull PrismSerializer<T> root(QName elementName)
Sets the name of the root element. Can be done either here or during call to serialize(..) methods.- Parameters:
elementName
- Name of the root element- Returns:
- Serializer with the root element name set.
-
definition
@NotNull @NotNull PrismSerializer<T> definition(ItemDefinition itemDefinition)
Sets the item definition to be used during serialization. (Not much used.)- Parameters:
itemDefinition
- Definition to be used.- Returns:
- Serializer with the definition set.
-
context
@NotNull @NotNull PrismSerializer<T> context(@Nullable @Nullable SerializationContext context)
Sets the context for the serialization operation, containing e.g. serialization options.- Parameters:
context
- Context to be set.- Returns:
- Serializer with the context set.
-
options
@NotNull @NotNull PrismSerializer<T> options(@Nullable @Nullable SerializationOptions options)
Sets the serialization options (part of the context).- Parameters:
options
- Options to be set.- Returns:
- Serializer with the options set.
-
itemsToSkip
@NotNull @NotNull PrismSerializer<T> itemsToSkip(Collection<? extends QName> itemNames)
These items will be skipped during serialization. If present, their original presence is indicated by the "incomplete" flag.- Parameters:
itemNames
- Names of items to be skipped.- Returns:
- Serializer with the items to be skipped set.
-
serialize
@NotNull T serialize(@NotNull @NotNull Item<?,?> item) throws SchemaException
Serializes given prism item.- Parameters:
item
- Item to be serialized.- Returns:
- String/RootXNode representation of the item.
- Throws:
SchemaException
-
serialize
@NotNull T serialize(@NotNull @NotNull PrismValue value) throws SchemaException
Serializes given prism value (property, reference, or container). Name of the root element is derived in the following way: 1. if explicit name is set (- Parameters:
value
- Value to be serialized.- Returns:
- String/RootXNode representation of the value.
- Throws:
SchemaException
-
serialize
@NotNull T serialize(@NotNull @NotNull PrismValue value, QName rootName) throws SchemaException
Serializes given prism value (property, reference, or container).- Parameters:
value
- Value to be serialized.rootName
- Name of the root element. (Overrides other means of deriving the name.)- Returns:
- String/RootXNode representation of the value.
- Throws:
SchemaException
-
serialize
@NotNull T serialize(@NotNull @NotNull RootXNode xnode) throws SchemaException
- Throws:
SchemaException
-
serializeObjects
@NotNull T serializeObjects(@NotNull @NotNull List<PrismObject<?>> objects) throws SchemaException
- Throws:
SchemaException
-
serialize
T serialize(javax.xml.bind.JAXBElement<?> value) throws SchemaException
- Throws:
SchemaException
-
serializeRealValue
T serializeRealValue(Object value) throws SchemaException
- Throws:
SchemaException
-
serializeRealValue
T serializeRealValue(Object value, QName rootName) throws SchemaException
- Throws:
SchemaException
-
serializeAnyData
T serializeAnyData(Object value) throws SchemaException
- Throws:
SchemaException
-
serializeAnyData
T serializeAnyData(Object value, QName rootName) throws SchemaException
- Throws:
SchemaException
-
-