Interface OsonConverter


  • public interface OsonConverter

    A converter which provides the conversion methods of POJO to OSON bytes and vice versa.

    Since:
    23.5
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.Object getObject​(byte[] osonBytes, java.lang.Class<?> type)
      Converts the given oson bytes into an instance of the type provided.
      byte[] getOson​(java.lang.Object object)
      Converts the given POJO to OSON bytes.
    • Method Detail

      • getOson

        byte[] getOson​(java.lang.Object object)
                throws java.lang.IllegalStateException
        Converts the given POJO to OSON bytes.
        Parameters:
        java - Object to be converted to OSON bytes. Maybe null.
        Returns:
        byte[] the converted OSON bytes. Maybe null.
        Throws:
        java.lang.IllegalStateException - if conversion fails
      • getObject

        java.lang.Object getObject​(byte[] osonBytes,
                                   java.lang.Class<?> type)
                            throws java.lang.IllegalStateException
        Converts the given oson bytes into an instance of the type provided.
        Parameters:
        ososBytes - to be converted to a POJO. Maybe null.
        type - of the expected POJO. Not null.
        Returns:
        instance of the POJO created from the provided OSON bytes. Maybe null.
        Throws:
        java.lang.IllegalStateException - if the type mapping is wrong or conversion fails