Class Serializer

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Serializer next  
    • Constructor Summary

      Constructors 
      Constructor Description
      Serializer()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract boolean canProcess​(java.lang.Object element)
      Checks if the serializer implementation can process the element type.
      abstract void process​(java.io.OutputStream outputStream, java.lang.Object element)
      Processes the provided element and serializes to output stream.
      void processElement​(java.io.OutputStream outputStream, java.lang.Object element)
      Wraps process(java.io.OutputStream, Object) and calls next serializer in chain.
      void setNext​(Serializer serializer)
      Sets the next serializer in the chain.
      • Methods inherited from class java.lang.Object

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

      • Serializer

        public Serializer()
    • Method Detail

      • setNext

        public void setNext​(Serializer serializer)
        Sets the next serializer in the chain.
        Parameters:
        serializer - the next serializer.
      • processElement

        public void processElement​(java.io.OutputStream outputStream,
                                   java.lang.Object element)
                            throws java.io.IOException
        Wraps process(java.io.OutputStream, Object) and calls next serializer in chain.
        Parameters:
        outputStream - the output stream.
        element - the element to process.
        Throws:
        java.io.IOException - IOException in case of IO error.
      • canProcess

        public abstract boolean canProcess​(java.lang.Object element)
        Checks if the serializer implementation can process the element type.
        Parameters:
        element - the element to process.
        Returns:
        true if the serializer can process the provided element.
      • process

        public abstract void process​(java.io.OutputStream outputStream,
                                     java.lang.Object element)
                              throws java.io.IOException
        Processes the provided element and serializes to output stream.
        Parameters:
        outputStream - the output stream.
        element - the element.
        Throws:
        java.io.IOException - In the case of IO error.