Package io.permazen.spring
Class DetachedPermazenTransactionHttpMessageConverter
java.lang.Object
org.springframework.http.converter.AbstractHttpMessageConverter<DetachedPermazenTransaction>
io.permazen.spring.DetachedPermazenTransactionHttpMessageConverter
- All Implemented Interfaces:
HttpMessageConverter<DetachedPermazenTransaction>
public class DetachedPermazenTransactionHttpMessageConverter
extends AbstractHttpMessageConverter<DetachedPermazenTransaction>
Spring
HttpMessageConverter
capable of
encoding and decoding a graph of PermazenObject
s contained in a DetachedPermazenTransaction
that is
backed by a MemoryKVStore
.
The MIME type used is application/x-permazen-transaction
.
Validation of all incoming objects is supported; see setValidationGroups()
.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final MediaType
MIME type supported by this class:application/x-permazen-transaction
.Fields inherited from class org.springframework.http.converter.AbstractHttpMessageConverter
logger
-
Constructor Summary
ConstructorDescriptionConstructor.DetachedPermazenTransactionHttpMessageConverter
(Permazen pdb, MediaType... supportedMediaTypes) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected Long
getContentLength
(DetachedPermazenTransaction jtx, MediaType contentType) protected DetachedPermazenTransaction
readInternal
(Class<? extends DetachedPermazenTransaction> clazz, HttpInputMessage input) void
setValidationGroups
(Class<?>... groups) Set validation groups used to validate all incoming objects.protected boolean
protected void
writeInternal
(DetachedPermazenTransaction jtx, HttpOutputMessage output) Methods inherited from class org.springframework.http.converter.AbstractHttpMessageConverter
addDefaultHeaders, canRead, canRead, canWrite, canWrite, getDefaultCharset, getDefaultContentType, getSupportedMediaTypes, read, setDefaultCharset, setSupportedMediaTypes, supportsRepeatableWrites, write
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.http.converter.HttpMessageConverter
getSupportedMediaTypes
-
Field Details
-
MIME_TYPE
MIME type supported by this class:application/x-permazen-transaction
.Can be overridden in the constructor.
-
-
Constructor Details
-
DetachedPermazenTransactionHttpMessageConverter
Constructor.- Parameters:
pdb
-Permazen
instance defining the convertible types
-
DetachedPermazenTransactionHttpMessageConverter
public DetachedPermazenTransactionHttpMessageConverter(Permazen pdb, MediaType... supportedMediaTypes) Constructor.- Parameters:
pdb
-Permazen
instance defining the convertible typessupportedMediaTypes
- supported media types
-
-
Method Details
-
setValidationGroups
Set validation groups used to validate all incoming objects.If set to null, no validation is performed. Otherwise, all incoming objects in the transaction are validated, using the specified validation groups, or
Default
if an empty is specified.By default, this is null.
- Parameters:
groups
- validation group(s) to use for validation; if empty,Default
is assumed; if null, no validation is performed
-
getContentLength
- Overrides:
getContentLength
in classAbstractHttpMessageConverter<DetachedPermazenTransaction>
-
supports
- Specified by:
supports
in classAbstractHttpMessageConverter<DetachedPermazenTransaction>
-
readInternal
protected DetachedPermazenTransaction readInternal(Class<? extends DetachedPermazenTransaction> clazz, HttpInputMessage input) throws IOException - Specified by:
readInternal
in classAbstractHttpMessageConverter<DetachedPermazenTransaction>
- Throws:
IOException
-
writeInternal
protected void writeInternal(DetachedPermazenTransaction jtx, HttpOutputMessage output) throws IOException - Specified by:
writeInternal
in classAbstractHttpMessageConverter<DetachedPermazenTransaction>
- Throws:
IOException
-