Class B2JsonHandlerMap


  • public class B2JsonHandlerMap
    extends java.lang.Object
    Holds a mapping from Class to B2JsonTypeHandler.

    The mapping starts out with initial contents, which must be ALL of the non-default mappings that will be used. If any other handlers are needed, the default B2JsonObjectHandler will be used for that class.

    This class is THREAD SAFE.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> B2JsonTypeHandler<T> getHandler​(java.lang.reflect.Type type)
      Gets the handler for a given class at the top level.
      • Methods inherited from class java.lang.Object

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

      • B2JsonHandlerMap

        public B2JsonHandlerMap()
    • Method Detail

      • getHandler

        public <T> B2JsonTypeHandler<T> getHandler​(java.lang.reflect.Type type)
                                            throws B2JsonException
        Gets the handler for a given class at the top level.

        This method is called when it's time to (de)serialize some JSON, from the toJson() and fromJson() methods. It is not called by other handlers. When one handler depends on another, it should call the getUninitializedHandler() method from its own initialize() method.

        So, this method does NOT need to be re-entrant, and in fact we assume that it's not.

        Throws:
        B2JsonException