Class JsonMediaTypeFactory

    • Constructor Detail

      • JsonMediaTypeFactory

        public JsonMediaTypeFactory​()
    • Method Detail

      • getMediaTypes

        public MediaType[] getMediaTypes​()
        Retrieves the Media-Types from the Media-Types property.
        Specified by:
        getMediaTypes in interface MediaTypesAccessor
        Returns:
        The Media-Types stored by the Media-Types property.
      • toMarshaled

        public String toMarshaled​(Object aObject)
                           throws org.refcodes.exception.MarshalException
        Specified by:
        toMarshaled in interface org.refcodes.factory.MarshalFactory<String>
        Throws:
        org.refcodes.exception.MarshalException
      • toUnmarshaled

        public <T> T toUnmarshaled​(String aHttpBody,
                                   Class<T> aType)
                            throws org.refcodes.exception.UnmarshalException
        Specified by:
        toUnmarshaled in interface org.refcodes.factory.UnmarshalFactory<String>
        Throws:
        org.refcodes.exception.UnmarshalException
      • toPlainJson

        protected String toPlainJson​(String aJson)
        Removes any prefixed variable declaration.
        Parameters:
        aJson - The JSON from which to remove any prefixed variable declaration.
        Returns:
        The JSON without any prefixed variable declaration.
      • toUnboxed

        protected String toUnboxed​(String aJson)
        Unboxes any enveloped JSON.
        Parameters:
        aJson - The JSON to be unboxed.
        Returns:
        The unboxed JSON.
      • toElementName

        protected String toElementName​(Class<?> aClass)
        Creates an element name for the class.
        Parameters:
        aClass - The class from which to retrieve the element name.
        Returns:
        The element name for the class.
      • toVariableDeclaration

        protected String toVariableDeclaration​(Class<?> aClass)
        Returns the JSON specific assignment declaration for the given class.
        Parameters:
        aClass - The class for which to construct the assignment declaration.
        Returns:
        The according assignment declaration.