Class FormMediaTypeFactory

java.lang.Object
org.refcodes.web.FormMediaTypeFactory
All Implemented Interfaces:
org.refcodes.factory.MarshalFactory<String>, org.refcodes.factory.MarshalFactory.MarshalFactoryComplement<InputStream>, org.refcodes.factory.MarshalFactory.MarshalFactoryComposite<String,InputStream>, org.refcodes.factory.UnmarshalFactory<String>, org.refcodes.factory.UnmarshalFactory.UnmarshalFactoryComplement<InputStream>, org.refcodes.factory.UnmarshalFactory.UnmarshalFactoryComposite<String,InputStream>, MediaTypeFactory, MediaTypesAccessor

public class FormMediaTypeFactory extends Object implements MediaTypeFactory
Implements the MediaTypeFactory for Media-Type "application/x-www-form-urlencoded" ( MediaType.APPLICATION_X_WWW_FORM_URLENCODED). CAUTION: This implementation can only marshal objects of (sub-)type Map of generic type String (key) and List containing String instances (value) as argument. Also supported is the derived FormFields type.
  • Constructor Details

    • FormMediaTypeFactory

      public FormMediaTypeFactory()
  • Method Details

    • 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
      This method expects an instance of (sub-)type Map of generic type String (key) and List containing String instances (value) as argument. Also supported is the derived FormFields type.
      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