public class ConverterService extends Service
Constructor and Description |
---|
ConverterService()
Constructor.
|
ConverterService(boolean enabled)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Representation |
applyPatch(Representation initial,
Representation patch)
Applies a patch representation to an initial representation in order to
obtain a modified one.
|
Representation |
createPatch(Representation initial,
Representation modified)
Creates a patch representation by calculating a diff between initial and
modified representations.
|
java.util.List<java.lang.Class<?>> |
getObjectClasses(Variant source)
Returns the list of object classes that can be converted from a given
variant.
|
java.util.List<MediaType> |
getPatchTypes(MediaType representationType)
Returns the list of patch media types available for the given
representation types.
|
java.util.List<? extends Variant> |
getVariants(java.lang.Class<?> source,
Variant target)
Returns the list of variants that can be converted from a given object
class.
|
Representation |
revertPatch(Representation modified,
Representation patch)
Reverts a patch representation from a modified representation in order to
obtain the initial one.
|
java.lang.Object |
toObject(Representation source)
Converts a Representation into a regular Java object.
|
<T> T |
toObject(Representation source,
java.lang.Class<T> target,
Resource resource)
Converts a Representation into a regular Java object.
|
Representation |
toRepresentation(java.lang.Object source)
Converts a regular Java object into a Representation.
|
Representation |
toRepresentation(java.lang.Object source,
MediaType target)
Converts a regular Java object into a Representation.
|
Representation |
toRepresentation(java.lang.Object source,
Variant target)
Converts a regular Java object into a Representation.
|
Representation |
toRepresentation(java.lang.Object source,
Variant target,
Resource resource)
Converts a regular Java object into a Representation.
|
void |
updatePreferences(java.util.List<Preference<MediaType>> preferences,
java.lang.Class<?> entity)
Updates the media type preferences with available conversion capabilities
for the given entity class.
|
createInboundFilter, createOutboundFilter, getContext, isEnabled, isStarted, isStopped, setContext, setEnabled, start, stop
public ConverterService()
public ConverterService(boolean enabled)
enabled
- True if the service has been enabled.public Representation applyPatch(Representation initial, Representation patch) throws java.io.IOException
ConverterService
to be able to process it.initial
- The initial representation on which the patch must be applied.patch
- The patch representation to apply.java.io.IOException
public Representation createPatch(Representation initial, Representation modified) throws java.io.IOException
initial
- The initial representation.modified
- The modified representation.java.io.IOException
public java.util.List<java.lang.Class<?>> getObjectClasses(Variant source)
source
- The source variant.public java.util.List<MediaType> getPatchTypes(MediaType representationType)
representationType
- The representation media type or null for all supported patch
types.public java.util.List<? extends Variant> getVariants(java.lang.Class<?> source, Variant target) throws java.io.IOException
source
- The source class.target
- The expected representation metadata.java.io.IOException
public Representation revertPatch(Representation modified, Representation patch) throws java.io.IOException
ConverterService
to be able to process it.modified
- The modified representation from which the patch must be
reverted.patch
- The patch representation to revert.java.io.IOException
public java.lang.Object toObject(Representation source) throws java.io.IOException
source
- The source representation to convert.java.io.IOException
public <T> T toObject(Representation source, java.lang.Class<T> target, Resource resource) throws java.io.IOException
T
- The expected class of the Java object.source
- The source representation to convert.target
- The target class of the Java object.resource
- The parent resource.java.io.IOException
public Representation toRepresentation(java.lang.Object source) throws java.io.IOException
source
- The source object to convert.java.io.IOException
public Representation toRepresentation(java.lang.Object source, MediaType target) throws java.io.IOException
source
- The source object to convert.target
- The target representation media type.java.io.IOException
public Representation toRepresentation(java.lang.Object source, Variant target) throws java.io.IOException
source
- The source object to convert.target
- The target representation variant.java.io.IOException
public Representation toRepresentation(java.lang.Object source, Variant target, Resource resource) throws java.io.IOException
source
- The source object to convert.target
- The target representation variant.resource
- The parent resource.java.io.IOException
public void updatePreferences(java.util.List<Preference<MediaType>> preferences, java.lang.Class<?> entity)
preferences
- The media type preferences.entity
- The entity class to convert.Copyright © 2005-2024 Restlet.