Class MarshallerRegistry

java.lang.Object
com.tangosol.coherence.rest.io.MarshallerRegistry

public class MarshallerRegistry extends Object
Registry for marshaller instances.

This class allows marshaller lookup based on root object class and media type, and attempts to create new marshallers for a given class and media type combination.

Author:
as 2011.07.10
  • Constructor Details

  • Method Details

    • getMarshaller

      public Marshaller getMarshaller(Class clzRoot, jakarta.ws.rs.core.MediaType mediaType)
      Return the marshaller for the specified root class and media type.
      Parameters:
      clzRoot - root object class
      mediaType - media type
      Returns:
      marshaller for the specified root class and media type
    • getMarshaller

      public Marshaller getMarshaller(Class clzRoot, String sMediaType)
      Return the marshaller for the specified root class and media type.
      Parameters:
      clzRoot - root object class
      sMediaType - media type
      Returns:
      marshaller for the specified root class and media type
    • registerMarshaller

      public void registerMarshaller(Class clzRoot, jakarta.ws.rs.core.MediaType mediaType, Class clzMarshaller)
      Register a marshaller for the specified root class and media type.
      Parameters:
      clzRoot - root object class
      mediaType - media type
      clzMarshaller - marshaller class
    • registerMarshaller

      public void registerMarshaller(Class clzRoot, String sMediaType, Class clzMarshaller)
      Register a marshaller for the specified root class and media type.
      Parameters:
      clzRoot - root object class
      sMediaType - media type
      clzMarshaller - marshaller class
    • registerMarshaller

      public void registerMarshaller(Class clzRoot, jakarta.ws.rs.core.MediaType mediaType, Marshaller marshaller)
      Register a marshaller for the specified root class and media type.
      Parameters:
      clzRoot - root object class
      mediaType - media type
      marshaller - marshaller to register
    • registerMarshaller

      public void registerMarshaller(Class clzRoot, String sMediaType, Marshaller marshaller)
      Register a marshaller for the specified root class and media type.
      Parameters:
      clzRoot - root object class
      sMediaType - media type
      marshaller - marshaller to register
    • setDefaultMarshaller

      public void setDefaultMarshaller(jakarta.ws.rs.core.MediaType mediaType, Class clzMarshaller)
      Configure the default marshaller class for the specified media type.
      Parameters:
      mediaType - media type to set default marshaller for
      clzMarshaller - default marshaller class
    • setDefaultMarshaller

      public void setDefaultMarshaller(String sMediaType, Class clzMarshaller)
      Configure the default marshaller class for the specified media type.
      Parameters:
      sMediaType - media type to set default marshaller for
      clzMarshaller - default marshaller class
    • setDefaultMarshallers

      public void setDefaultMarshallers(Map<String,Class> mapMarshallers)
      Configure the default marshaller classes for the corresponding media types.
      Parameters:
      mapMarshallers - a map of REST marshaller classes keyed by media type
    • createKey

      protected String createKey(Class clzRoot, String sMediaType)
      Create a key for the marshallers map.
      Parameters:
      clzRoot - root object class
      sMediaType - media type
      Returns:
      key for the marshallers cache
    • createDefaultMarshaller

      protected Marshaller createDefaultMarshaller(Class clzRoot, String sMediaType)
      Create default marshaller for the specified class and media type.
      Parameters:
      clzRoot - root object class
      sMediaType - media type
      Returns:
      default marshaller for the specified class and media type
    • createMarshaller

      protected Marshaller createMarshaller(Class<?> clzRoot, String sMediaType, Class<?> clzMarshaller)
      Create marshaller instance.
      Parameters:
      clzRoot - root object class
      sMediaType - media type
      clzMarshaller - marshaller class
      Returns:
      marshaller instance