Class AbstractTranscoder
java.lang.Object
org.infinispan.commons.dataconversion.AbstractTranscoder
- All Implemented Interfaces:
Transcoder
- Direct Known Subclasses:
DefaultTranscoder
,OneToManyTranscoder
,TwoStepTranscoder
Class to inherit when implementing transcoders, will handle pre and post processing of the content.
- Since:
- 13.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Object
decodeContent
(Object content, MediaType contentType) Decodes content before doing the transcoding.protected abstract Object
doTranscode
(Object decoded, MediaType contentType, MediaType destinationType) protected Object
encodeContent
(Object content, MediaType destinationType) Encode the content after transcoding if necessary.Transcodes content between two differentMediaType
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.infinispan.commons.dataconversion.Transcoder
getSupportedMediaTypes, supports, supportsConversion
-
Constructor Details
-
AbstractTranscoder
public AbstractTranscoder()
-
-
Method Details
-
decodeContent
protected Object decodeContent(Object content, MediaType contentType) throws UnsupportedEncodingException Decodes content before doing the transcoding.- Parameters:
content
- the content.contentType
- theMediaType
describing the content.- Returns:
- an Object with the content decoded or the content itself if no decoding needed.
- Throws:
UnsupportedEncodingException
- if an invalid encoding or type is provided.
-
encodeContent
protected Object encodeContent(Object content, MediaType destinationType) throws UnsupportedEncodingException Encode the content after transcoding if necessary.- Parameters:
content
- The content to encode.destinationType
- The destinationMediaType
- Returns:
- The value encoded or unchanged if no encoding is needed.
- Throws:
UnsupportedEncodingException
-
transcode
Description copied from interface:Transcoder
Transcodes content between two differentMediaType
.- Specified by:
transcode
in interfaceTranscoder
- Parameters:
content
- Content to transcode.contentType
- TheMediaType
of the content.destinationType
- The targetMediaType
to convert.- Returns:
- the transcoded content.
-
doTranscode
-