|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.engine.Helper
org.restlet.engine.converter.ConverterHelper
public abstract class ConverterHelper
Converter between Representations and regular Java objects.
Constructor Summary | |
---|---|
ConverterHelper()
|
Method Summary | ||
---|---|---|
protected List<Class<?>> |
addObjectClass(List<Class<?>> objectClasses,
Class<?> objectClass)
Adds an object class to the given list. |
|
protected List<VariantInfo> |
addVariant(List<VariantInfo> variants,
VariantInfo userVariant)
Adds a variant to the given list. |
|
List<VariantInfo> |
addVariants(Class<?> sourceClass,
Variant targetVariant,
List<VariantInfo> variants)
Returns the list of variants that can be converted from a given object class. |
|
abstract List<Class<?>> |
getObjectClasses(Variant source)
Returns the list of object classes that can be converted from a given variant. |
|
abstract List<VariantInfo> |
getVariants(Class<?> source)
Returns the list of variants that can be converted from a given object class. |
|
List<VariantInfo> |
getVariants(Class<?> sourceClass,
Variant targetVariant)
Returns the list of variants that can be converted from a given object class by a specific converter helper. |
|
abstract float |
score(Object source,
Variant target,
Resource resource)
Scores the affinity of this helper with the source class. |
|
abstract
|
score(Representation source,
Class<T> target,
Resource resource)
Scores the affinity of this helper with the source class. |
|
abstract
|
toObject(Representation source,
Class<T> target,
Resource resource)
Converts a Representation into a regular Java object. |
|
abstract Representation |
toRepresentation(Object source,
Variant target,
Resource resource)
Converts a regular Java object into a Representation. |
|
|
updatePreferences(List<Preference<MediaType>> preferences,
Class<T> entity)
Updates the preferences of the given ClientInfo object with
conversion capabilities for the given entity class. |
|
void |
updatePreferences(List<Preference<MediaType>> preferences,
MediaType mediaType,
float score)
Updates the preferences of the given ClientInfo object with
conversion capabilities for the given entity class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConverterHelper()
Method Detail |
---|
protected List<Class<?>> addObjectClass(List<Class<?>> objectClasses, Class<?> objectClass)
objectClasses
- The object classes list to update or null.objectClass
- The object class to add.
protected List<VariantInfo> addVariant(List<VariantInfo> variants, VariantInfo userVariant)
variants
- The variants list to update or null.userVariant
- The variant to add if not null.
public List<VariantInfo> addVariants(Class<?> sourceClass, Variant targetVariant, List<VariantInfo> variants)
sourceClass
- The source class.targetVariant
- The expected representation metadata.variants
- The variants list to update.public abstract List<Class<?>> getObjectClasses(Variant source)
source
- The source variant.
public abstract List<VariantInfo> getVariants(Class<?> source)
source
- The source object class.
public List<VariantInfo> getVariants(Class<?> sourceClass, Variant targetVariant)
sourceClass
- The source class.targetVariant
- The expected representation metadata.
public abstract float score(Object source, Variant target, Resource resource)
source
- The source object to convert.target
- The expected representation metadata.resource
- The calling resource.
public abstract <T> float score(Representation source, Class<T> target, Resource resource)
source
- The source representation to convert.target
- The expected class of the Java object.resource
- The calling resource.
public abstract <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 expected class of the Java object.resource
- The calling resource.
IOException
public abstract Representation toRepresentation(Object source, Variant target, Resource resource) throws IOException
source
- The source object to convert.target
- The expected representation metadata.resource
- The calling resource.
IOException
public <T> void updatePreferences(List<Preference<MediaType>> preferences, Class<T> entity)
ClientInfo
object with
conversion capabilities for the given entity class.
preferences
- The media type preferences.entity
- The entity class to convert.public void updatePreferences(List<Preference<MediaType>> preferences, MediaType mediaType, float score)
ClientInfo
object with
conversion capabilities for the given entity class.
preferences
- The media type preferences.mediaType
- The media type to update to add to the preferences.score
- The media type score to use as a quality score.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |