Package org.restlet.engine.converter
Class StatusInfoHtmlConverter
java.lang.Object
org.restlet.engine.Helper
org.restlet.engine.converter.ConverterHelper
org.restlet.engine.converter.StatusInfoHtmlConverter
Converter for the
StatusInfo class.- Author:
- Manuel Boillod
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetObjectClasses(Variant source) Returns the list of object classes that can be converted from a given variant.protected StringgetStatusLabel(StatusInfo status) Returns the status information to display in the default representation.getVariants(Class<?> source) Returns the list of variants that can be converted from a given object class.protected booleanisCompatible(Variant variant) Indicates if the given variant is compatible with the media types supported by this converter.floatScores the affinity of this helper with the source class.<T> floatscore(Representation source, Class<T> target, Resource resource) Scores the affinity of this helper with the source class.protected RepresentationtoHtml(StatusInfo status) Returns a representation for the given status.
In order to customize the default representation, this method can be overridden.<T> TtoObject(Representation source, Class<T> target, Resource resource) Converts a Representation into a regular Java object.toRepresentation(Object source, Variant target, Resource resource) Converts a regular Java object into a Representation.Methods inherited from class org.restlet.engine.converter.ConverterHelper
addObjectClass, addVariant, addVariants, getVariants, updatePreferences, updatePreferences
-
Constructor Details
-
StatusInfoHtmlConverter
public StatusInfoHtmlConverter()
-
-
Method Details
-
getObjectClasses
Description copied from class:ConverterHelperReturns the list of object classes that can be converted from a given variant.- Specified by:
getObjectClassesin classConverterHelper- Parameters:
source- The source variant.- Returns:
- The list of object class that can be converted.
-
getStatusLabel
Returns the status information to display in the default representation. By default it returns the status's reason phrase.- Parameters:
status- The status.- Returns:
- The status information.
- See Also:
-
getVariants
Description copied from class:ConverterHelperReturns the list of variants that can be converted from a given object class. The preferred variant should be set in first position.- Specified by:
getVariantsin classConverterHelper- Parameters:
source- The source object class.- Returns:
- The list of variants that can be converted.
- Throws:
IOException
-
isCompatible
Indicates if the given variant is compatible with the media types supported by this converter.- Parameters:
variant- The variant.- Returns:
- True if the given variant is compatible with the media types supported by this converter.
-
score
Description copied from class:ConverterHelperScores the affinity of this helper with the source class.- Specified by:
scorein classConverterHelper- Parameters:
source- The source object to convert.target- The expected representation metadata.resource- The calling resource.- Returns:
- The affinity score of this helper.
-
score
Description copied from class:ConverterHelperScores the affinity of this helper with the source class.- Specified by:
scorein classConverterHelper- Type Parameters:
T- The expected class of the Java object.- Parameters:
source- The source representation to convert.target- The expected class of the Java object.resource- The calling resource.- Returns:
- The affinity score of this helper.
-
toHtml
Returns a representation for the given status.
In order to customize the default representation, this method can be overridden.- Parameters:
status- The status info to represent.- Returns:
- The representation of the given status.
-
toObject
Description copied from class:ConverterHelperConverts a Representation into a regular Java object.- Specified by:
toObjectin classConverterHelper- Type Parameters:
T- The expected class of the Java object.- Parameters:
source- The source representation to convert.target- The expected class of the Java object.resource- The calling resource.- Returns:
- The converted Java object.
- Throws:
IOException
-
toRepresentation
public Representation toRepresentation(Object source, Variant target, Resource resource) throws IOException Description copied from class:ConverterHelperConverts a regular Java object into a Representation.- Specified by:
toRepresentationin classConverterHelper- Parameters:
source- The source object to convert.target- The expected representation metadata.resource- The calling resource.- Returns:
- The converted representation.
- Throws:
IOException
-