public class ConverterService extends Service
Constructor and Description |
---|
ConverterService()
Constructor.
|
ConverterService(boolean enabled)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
List<Class<?>> |
getObjectClasses(Variant source)
Returns the list of object classes that can be converted from a given
variant.
|
List<? extends Variant> |
getVariants(Class<?> source,
Variant target)
Returns the list of variants that can be converted from a given object
class.
|
Object |
toObject(Representation source)
Converts a Representation into a regular Java object.
|
<T> T |
toObject(Representation source,
Class<T> target,
Resource resource)
Converts a Representation into a regular Java object.
|
Representation |
toRepresentation(Object source)
Converts a regular Java object into a Representation.
|
Representation |
toRepresentation(Object source,
Variant target,
Resource resource)
Converts a regular Java object into a Representation.
|
void |
updatePreferences(List<Preference<MediaType>> preferences,
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 List<Class<?>> getObjectClasses(Variant source)
source
- The source variant.public List<? extends Variant> getVariants(Class<?> source, Variant target)
source
- The source class.target
- The expected representation metadata.public Object toObject(Representation source) throws IOException
source
- The source representation to convert.IOException
public <T> T toObject(Representation source, Class<T> target, Resource resource) throws 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.IOException
public Representation toRepresentation(Object source)
source
- The source object to convert.public Representation toRepresentation(Object source, Variant target, Resource resource)
source
- The source object to convert.target
- The target representation variant.resource
- The parent resource.public void updatePreferences(List<Preference<MediaType>> preferences, Class<?> entity)
preferences
- The media type preferences.entity
- The entity class to convert.Copyright © 2005–2014. All rights reserved.