Class JadexBasicTypeSerializer

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String convertObject​(java.lang.Object val, java.lang.Class<?> type, java.lang.ClassLoader cl, java.lang.Object context)
      Convert an object to a string.
      java.lang.Object convertString​(java.lang.String val, java.lang.Class<?> type, java.lang.ClassLoader cl, java.lang.Object context)
      Convert a string to an object.
      java.lang.Object decode​(byte[] bytes, java.lang.ClassLoader classloader, ITraverseProcessor[] postprocs, IErrorReporter rep, java.lang.Object usercontext)
      Decode an object.
      java.lang.Object decode​(java.io.InputStream is, java.lang.ClassLoader classloader, ITraverseProcessor[] postprocs, IErrorReporter rep, java.lang.Object usercontext)
      Decode an object.
      byte[] encode​(java.lang.Object val, java.lang.ClassLoader classloader, ITraverseProcessor[] preprocs, java.lang.Object usercontext)
      Encode data with the serializer.
      int getSerializerId()
      Get the serializer id.
      java.lang.String getType()
      Get the type of string that can be processed (xml, json, plain).
      boolean isSupportedType​(java.lang.Class<?> clazz)
      Test if the type can be converted.
      • Methods inherited from class java.lang.Object

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

      • JadexBasicTypeSerializer

        public JadexBasicTypeSerializer()
        The basic type converter.
    • Method Detail

      • getSerializerId

        public int getSerializerId()
        Get the serializer id.
        Specified by:
        getSerializerId in interface ISerializer
        Returns:
        The serializer id.
      • encode

        public byte[] encode​(java.lang.Object val,
                             java.lang.ClassLoader classloader,
                             ITraverseProcessor[] preprocs,
                             java.lang.Object usercontext)
        Encode data with the serializer.
        Specified by:
        encode in interface ISerializer
        Parameters:
        val - The value.
        classloader - The classloader.
        preproc - The encoding preprocessors.
        Returns:
        The encoded object.
      • decode

        public java.lang.Object decode​(byte[] bytes,
                                       java.lang.ClassLoader classloader,
                                       ITraverseProcessor[] postprocs,
                                       IErrorReporter rep,
                                       java.lang.Object usercontext)
        Decode an object.
        Specified by:
        decode in interface ISerializer
        Parameters:
        bytes - The value bytes as byte array or input stream.
        Returns:
        The decoded object.
        Throws:
        java.io.IOException
      • decode

        public java.lang.Object decode​(java.io.InputStream is,
                                       java.lang.ClassLoader classloader,
                                       ITraverseProcessor[] postprocs,
                                       IErrorReporter rep,
                                       java.lang.Object usercontext)
        Decode an object.
        Specified by:
        decode in interface ISerializer
        Returns:
        The decoded object.
        Throws:
        java.io.IOException
      • convertString

        public java.lang.Object convertString​(java.lang.String val,
                                              java.lang.Class<?> type,
                                              java.lang.ClassLoader cl,
                                              java.lang.Object context)
        Convert a string to an object.
        Specified by:
        convertString in interface IStringConverter
        Parameters:
        val - The string.
        type - The target type.
        context - The context.
        Returns:
        The object.
      • convertObject

        public java.lang.String convertObject​(java.lang.Object val,
                                              java.lang.Class<?> type,
                                              java.lang.ClassLoader cl,
                                              java.lang.Object context)
        Convert an object to a string.
        Specified by:
        convertObject in interface IStringConverter
        Parameters:
        val - The object.
        type - The encoding type.
        context - The context.
        Returns:
        The object.
      • getType

        public java.lang.String getType()
        Get the type of string that can be processed (xml, json, plain).
        Specified by:
        getType in interface IStringConverter
        Returns:
        The object.
      • isSupportedType

        public boolean isSupportedType​(java.lang.Class<?> clazz)
        Test if the type can be converted.
        Specified by:
        isSupportedType in interface IStringConverter
        Parameters:
        clazz - The class.
        Returns:
        True if can be converted.