Package org.apache.ignite.marshaller

## Class Marshallers

- java.lang.Object
- - org.apache.ignite.marshaller.Marshallers

-     public class Marshallers
      extends Object

  Factory to create implementation of `Marshaller`.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static ThreadLocal<Boolean>` | `USE_CACHE` | Flag whether class caching should be used by the current thread.
    `static boolean` | `USE_DFLT_SUID` | Use default `serialVersionUID` for `Serializable` classes.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Marshallers()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static JdkMarshaller` | `jdk()` |
    `static JdkMarshaller` | `jdk​(@Nullable IgnitePredicate<String> clsFilter)` |
    `static void` | `marshal​(Marshaller marsh, @Nullable Object obj, OutputStream out)` | Marshals object to byte array.
    `static byte[]` | `marshal​(Marshaller marsh, Object obj)` | Marshals object to byte array.
    `static org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller` | `optimized()` |
    `static org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller` | `optimized​(boolean requireSer)` | Creates new marshaller providing whether it should require `Serializable` interface or not.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### USE_CACHE

          public static final ThreadLocal<Boolean> USE_CACHE

      Flag whether class caching should be used by the current thread.

    - #### USE_DFLT_SUID

          public static final boolean USE_DFLT_SUID

      Use default `serialVersionUID` for `Serializable` classes.

  - ### Constructor Detail

    - #### Marshallers

          public Marshallers()

  - ### Method Detail

    - #### jdk

          public static JdkMarshaller jdk()

      Returns:
        Default instance of `JdkMarshaller`.

    - #### jdk

          public static JdkMarshaller jdk​(@Nullable
                                          @Nullable IgnitePredicate<String> clsFilter)

      Parameters:
        `clsFilter` - Class filter.
      Returns:
        Filtered instance of `JdkMarshaller`.

    - #### optimized

          public static org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller optimized()

      Returns:
        Optimized marshaller instance.

    - #### optimized

          public static org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller optimized​(boolean requireSer)

      Creates new marshaller providing whether it should require `Serializable` interface or not.
      Parameters:
        `requireSer` - Whether to require `Serializable`.
      Returns:
        Optimized marshaller instance.

    - #### marshal

          public static byte[] marshal​(Marshaller marsh,
                                       Object obj)
                                throws IgniteCheckedException

      Marshals object to byte array.

      This method wraps marshaller invocations and guaranty throws `IgniteCheckedException` in fail case.
      Parameters:
        `marsh` - Marshaller.
        `obj` - Object to marshal.
      Returns:
        Byte array.
      Throws:
        `IgniteCheckedException` - If marshalling failed.

    - #### marshal

          public static void marshal​(Marshaller marsh,
                                     @Nullable
                                     @Nullable Object obj,
                                     OutputStream out)
                              throws IgniteCheckedException

      Marshals object to byte array.

      This method wraps marshaller invocations and guaranty throws `IgniteCheckedException` in fail case.
      Parameters:
        `marsh` - Marshaller.
        `obj` - Object to marshal.
        `out` - Output stream.
      Throws:
        `IgniteCheckedException` - If marshalling failed.