* Serializer of Binding objects to Normalized Node which uses
* {@link BindingNormalizedNodeCache} to cache already serialized values.
*
+ * <p>
* This serializer implements {@link BindingStreamEventWriter} along with
* {@link BindingSerializer}.
*
/**
* Serializes input if it is cached, returns null otherwise.
*
+ * <p>
* If input is cached it uses
* {@link NormalizedNodeWithAddChildWriter#addChild(NormalizedNode)} to
* provide already serialized value to underlying NormalizedNodeWriter in
* order to reuse value instead of creating new one using Normalized Node
* stream APIs.
*
+ * <p>
* Note that this optional is serialization of child node invoked from
* {@link TreeNodeSerializer}, which may opt-out from streaming of data when
* non-null result is returned.
return null;
}
- @SuppressWarnings({ "rawtypes", "unchecked" })
- private BindingNormalizedNodeCache getCacheSerializer(final Class type) {
- if (cacheHolder.isCached(type)) {
- final DataContainerCodecContext<?, ?> currentCtx = (DataContainerCodecContext<?, ?>) delegate.current();
- if (type.equals(currentCtx.getBindingClass())) {
- return cacheHolder.getCachingSerializer(currentCtx);
- }
- return cacheHolder.getCachingSerializer(currentCtx.streamChild(type));
- }
- return null;
- }
-
/**
* Serializes supplied data using stream writer with child cache enabled or
* using cache directly if cache is avalaible also for supplied Codec node.
return serializeUsingStreamWriter(cacheHolder, subtreeRoot, data);
}
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ private BindingNormalizedNodeCache getCacheSerializer(final Class type) {
+ if (cacheHolder.isCached(type)) {
+ final DataContainerCodecContext<?, ?> currentCtx = (DataContainerCodecContext<?, ?>) delegate.current();
+ if (type.equals(currentCtx.getBindingClass())) {
+ return cacheHolder.getCachingSerializer(currentCtx);
+ }
+ return cacheHolder.getCachingSerializer(currentCtx.streamChild(type));
+ }
+ return null;
+ }
+
/**
* Serializes supplied data using stream writer with child cache enabled.
*