Class StatusInfoHtmlConverter

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<java.lang.Class<?>> getObjectClasses​(org.restlet.representation.Variant source)
      Returns the list of object classes that can be converted from a given variant.
      protected java.lang.String getStatusLabel​(StatusInfo status)
      Returns the status information to display in the default representation.
      java.util.List<VariantInfo> getVariants​(java.lang.Class<?> source)
      Returns the list of variants that can be converted from a given object class.
      protected boolean isCompatible​(org.restlet.representation.Variant variant)
      Indicates if the given variant is compatible with the media types supported by this converter.
      float score​(java.lang.Object source, org.restlet.representation.Variant target, org.restlet.resource.Resource resource)
      Scores the affinity of this helper with the source class.
      <T> float score​(org.restlet.representation.Representation source, java.lang.Class<T> target, org.restlet.resource.Resource resource)
      Scores the affinity of this helper with the source class.
      protected org.restlet.representation.Representation toHtml​(StatusInfo status)
      Returns a representation for the given status.
      In order to customize the default representation, this method can be overridden.
      <T> T toObject​(org.restlet.representation.Representation source, java.lang.Class<T> target, org.restlet.resource.Resource resource)
      Converts a Representation into a regular Java object.
      org.restlet.representation.Representation toRepresentation​(java.lang.Object source, org.restlet.representation.Variant target, org.restlet.resource.Resource resource)
      Converts a regular Java object into a Representation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StatusInfoHtmlConverter

        public StatusInfoHtmlConverter()
    • Method Detail

      • getObjectClasses

        public java.util.List<java.lang.Class<?>> getObjectClasses​(org.restlet.representation.Variant source)
        Description copied from class: ConverterHelper
        Returns the list of object classes that can be converted from a given variant.
        Specified by:
        getObjectClasses in class ConverterHelper
        Parameters:
        source - The source variant.
        Returns:
        The list of object class that can be converted.
      • getStatusLabel

        protected java.lang.String getStatusLabel​(StatusInfo status)
        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:
        StatusService.toRepresentation(Status, Request, Response)
      • getVariants

        public java.util.List<VariantInfo> getVariants​(java.lang.Class<?> source)
                                                throws java.io.IOException
        Description copied from class: ConverterHelper
        Returns the list of variants that can be converted from a given object class. The preferred variant should be set in first position.
        Specified by:
        getVariants in class ConverterHelper
        Parameters:
        source - The source object class.
        Returns:
        The list of variants that can be converted.
        Throws:
        java.io.IOException
      • isCompatible

        protected boolean isCompatible​(org.restlet.representation.Variant variant)
        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

        public float score​(java.lang.Object source,
                           org.restlet.representation.Variant target,
                           org.restlet.resource.Resource resource)
        Description copied from class: ConverterHelper
        Scores the affinity of this helper with the source class.
        Specified by:
        score in class ConverterHelper
        Parameters:
        source - The source object to convert.
        target - The expected representation metadata.
        resource - The calling resource.
        Returns:
        The affinity score of this helper.
      • score

        public <T> float score​(org.restlet.representation.Representation source,
                               java.lang.Class<T> target,
                               org.restlet.resource.Resource resource)
        Description copied from class: ConverterHelper
        Scores the affinity of this helper with the source class.
        Specified by:
        score in class ConverterHelper
        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

        protected org.restlet.representation.Representation toHtml​(StatusInfo status)
        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

        public <T> T toObject​(org.restlet.representation.Representation source,
                              java.lang.Class<T> target,
                              org.restlet.resource.Resource resource)
                       throws java.io.IOException
        Description copied from class: ConverterHelper
        Converts a Representation into a regular Java object.
        Specified by:
        toObject in class ConverterHelper
        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:
        java.io.IOException
      • toRepresentation

        public org.restlet.representation.Representation toRepresentation​(java.lang.Object source,
                                                                          org.restlet.representation.Variant target,
                                                                          org.restlet.resource.Resource resource)
                                                                   throws java.io.IOException
        Description copied from class: ConverterHelper
        Converts a regular Java object into a Representation.
        Specified by:
        toRepresentation in class ConverterHelper
        Parameters:
        source - The source object to convert.
        target - The expected representation metadata.
        resource - The calling resource.
        Returns:
        The converted representation.
        Throws:
        java.io.IOException