Package examples

Class CustomTranslatorExample.JavaSerializerTranslator<T>

  • All Implemented Interfaces:
    Translator<java.io.InputStream,​T>
    Enclosing class:
    CustomTranslatorExample

    public static class CustomTranslatorExample.JavaSerializerTranslator<T>
    extends java.lang.Object
    implements Translator<java.io.InputStream,​T>
    Translates binary data to entity instances using Java standard serialization. Alternatively, you can use Translator.define(Function, Class, Class) for translator creation.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Class<java.io.InputStream> inputType()  
      java.lang.Class<T> outputType()  
      T translate​(java.io.InputStream resource)
      Performs the actual translation.
      • Methods inherited from class java.lang.Object

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

      • JavaSerializerTranslator

        public JavaSerializerTranslator​(java.lang.Class<T> type)
    • Method Detail

      • translate

        public T translate​(java.io.InputStream resource)
        Description copied from interface: Translator
        Performs the actual translation.
        Specified by:
        translate in interface Translator<java.io.InputStream,​T>
        Parameters:
        resource - input resource
        Returns:
        translated instance
      • inputType

        public java.lang.Class<java.io.InputStream> inputType()
        Specified by:
        inputType in interface Translator<java.io.InputStream,​T>
        Returns:
        input T class
      • outputType

        public java.lang.Class<T> outputType()
        Specified by:
        outputType in interface Translator<java.io.InputStream,​T>
        Returns:
        output R class