public class DefaultConverter extends ConverterHelper
| Constructor and Description |
|---|
DefaultConverter() |
| 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<VariantInfo> |
getVariants(Class<?> source)
Returns the list of variants that can be converted from a given object class.
|
float |
score(Object source,
Variant target,
Resource resource)
Scores the affinity of this helper with the source class.
|
<T> float |
score(Representation source,
Class<T> target,
Resource resource)
Scores the affinity of this helper with the source class.
|
<T> T |
toObject(Representation source,
Class<T> target,
Resource resource)
Converts a Representation into a regular Java object.
|
Representation |
toRepresentation(Object source,
Variant target,
Resource resource)
Converts a regular Java object into a Representation.
|
<T> void |
updatePreferences(List<Preference<MediaType>> preferences,
Class<T> entity)
Updates the preferences of the given
ClientInfo object with
conversion capabilities for the given entity class. |
addObjectClass, addVariant, addVariants, getVariants, updatePreferencespublic List<Class<?>> getObjectClasses(Variant source)
ConverterHelpergetObjectClasses in class ConverterHelpersource - The source variant.public List<VariantInfo> getVariants(Class<?> source)
ConverterHelpergetVariants in class ConverterHelpersource - The source object class.public float score(Object source, Variant target, Resource resource)
ConverterHelperscore in class ConverterHelpersource - The source object to convert.target - The expected representation metadata.resource - The calling resource.public <T> float score(Representation source, Class<T> target, Resource resource)
ConverterHelperscore in class ConverterHelperT - 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.public <T> T toObject(Representation source, Class<T> target, Resource resource) throws IOException
ConverterHelpertoObject in class ConverterHelperT - 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.IOExceptionpublic Representation toRepresentation(Object source, Variant target, Resource resource) throws IOException
ConverterHelpertoRepresentation in class ConverterHelpersource - The source object to convert.target - The expected representation metadata.resource - The calling resource.IOExceptionpublic <T> void updatePreferences(List<Preference<MediaType>> preferences, Class<T> entity)
ConverterHelperClientInfo object with
conversion capabilities for the given entity class.updatePreferences in class ConverterHelperpreferences - The media type preferences.entity - The entity class to convert.Copyright © 2005–2025. All rights reserved.