Package org.kie.api.marshalling

## Interface ObjectMarshallingStrategy

-     public interface ObjectMarshallingStrategy

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface | Description
    --- | --- | ---
    `static interface` | `ObjectMarshallingStrategy.Context` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `accept​(java.lang.Object object)` |
    `ObjectMarshallingStrategy.Context` | `createContext()` | Creates a new marshalling context
    `default java.lang.String` | `getName()` | Override this method if you want multiple marshalling strategies of the same implementation in environment
    `byte[]` | `marshal​(ObjectMarshallingStrategy.Context context, java.io.ObjectOutputStream os, java.lang.Object object)` | This method is analogous to the write() method, but instead of writing the object into an output stream, it returns the marshalled object as a byte[].
    `java.lang.Object` | `read​(java.io.ObjectInputStream os)` |
    `java.lang.Object` | `unmarshal​(ObjectMarshallingStrategy.Context context, java.io.ObjectInputStream is, byte[] object, java.lang.ClassLoader classloader)` | This method is analogous to the read method, but instead of reading it from an input stream, it reads it from a byte[]
    `void` | `write​(java.io.ObjectOutputStream os, java.lang.Object object)` |

- - ### Method Detail

    - #### getName

          default java.lang.String getName()

      Override this method if you want multiple marshalling strategies of the same implementation in environment
      Returns:
        the unique name in runtime environment of the ObjectMarshallingStrategy

    - #### accept

          boolean accept​(java.lang.Object object)

    - #### write

          void write​(java.io.ObjectOutputStream os,
                     java.lang.Object object)
              throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### read

          java.lang.Object read​(java.io.ObjectInputStream os)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException

      Throws:
        `java.io.IOException`
        `java.lang.ClassNotFoundException`

    - #### marshal

          byte[] marshal​(ObjectMarshallingStrategy.Context context,
                         java.io.ObjectOutputStream os,
                         java.lang.Object object)
                  throws java.io.IOException

      This method is analogous to the write() method, but instead of writing the object into an output stream, it returns the marshalled object as a byte[].
      Parameters:
        `context` - the context for this strategy created by the method #createContext()
        `object` - the object to be marshalled
      Returns:
        the marshalled byte[] of the input object
      Throws:
        `java.io.IOException`

    - #### unmarshal

          java.lang.Object unmarshal​(ObjectMarshallingStrategy.Context context,
                                     java.io.ObjectInputStream is,
                                     byte[] object,
                                     java.lang.ClassLoader classloader)
                              throws java.io.IOException,
                                     java.lang.ClassNotFoundException

      This method is analogous to the read method, but instead of reading it from an input stream, it reads it from a byte[]
      Parameters:
        `context` - the context for this strategy created by the method #createContext()
        `object` - the marshalled object in a byte[]
      Returns:
        the unmarshalled Object
      Throws:
        `java.io.IOException`
        `java.lang.ClassNotFoundException`

    - #### createContext

          ObjectMarshallingStrategy.Context createContext()

      Creates a new marshalling context