Class TypeRenamingPersistentInputStream

java.lang.Object
com.fishlib.dataobjects.persistence.WObjectInputStream
com.fishlib.dataobjects.persistence.PersistentInputStream
com.illumon.iris.db.tables.TypeRenamingPersistentInputStream
All Implemented Interfaces:
com.fishlib.dataobjects.persistence.WObjectStreamConstants, Closeable, DataInput, ObjectInput, AutoCloseable

public class TypeRenamingPersistentInputStream extends com.fishlib.dataobjects.persistence.PersistentInputStream
Enterprise makes extensive use of Java serialization through WObjectOutputStream and WObjectInputStream, which use a custom encoding to write data. The consequence of this is that we'll end up with encoded type names. This class allows clients to attempt to dynamically rewrite certain type names at load time.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    This is an exact copy of com.fishlib.dataobjects.persistence.WObjectInputConversions.RenamingConversion with convertClassDescriptor implemented like convertResolveClassDescriptor

    Nested classes/interfaces inherited from class com.fishlib.dataobjects.persistence.WObjectInputStream

    com.fishlib.dataobjects.persistence.WObjectInputStream.ObjectConverter, com.fishlib.dataobjects.persistence.WObjectInputStream.WrappedObjectInputStream
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     

    Fields inherited from class com.fishlib.dataobjects.persistence.WObjectInputStream

    in_

    Fields inherited from interface com.fishlib.dataobjects.persistence.WObjectStreamConstants

    ADD_CLASS, ADD_COLUMN_SET_CLASS, ADD_ENUM, ADD_ENUM_LONG, ADO_ARRAY_TYPE, ARRAY_TYPE, BOOLEAN_TYPE, BYTE_ARRAY_TYPE, BYTE_TYPE, DATE_TYPE, DOUBLE_ARRAY_TYPE, DOUBLE_TYPE, FLOAT_ARRAY_TYPE, FLOAT_TYPE, INT_ARRAY_TYPE, INTEGER_TYPE, KNOWN_ENUM, KNOWN_ENUM_LONG, LINKED_MAP_TYPE, LINKED_SET_TYPE, LONG_ARRAY_TYPE, LONG_STRING_TYPE, LONG_TYPE, MAP_TYPE, NULL_TYPE, OBJECT_TYPE, SET_TYPE, STRING_ARRAY_TYPE, STRING_TYPE, TREE_MAP_TYPE, TREE_SET_TYPE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected com.fishlib.dataobjects.persistence.WObjectInputStream.ObjectConverter
    There are a few different paths within WObjectInputStream that resolve packages to real classes, this one handles the path when the object is plainly encoded in the stream.
     
    Set a type renamer that returns a renamed type string or returns null if no renaming is needed.

    Methods inherited from class com.fishlib.dataobjects.persistence.PersistentInputStream

    getColumnSet, getConversionSchema

    Methods inherited from class com.fishlib.dataobjects.persistence.WObjectInputStream

    available, close, getClassForType, read, read, read, readBoolean, readByte, readChar, readClassDescriptorOverride, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readObject, readShort, readUnsignedByte, readUnsignedShort, readUTF, skip, skipBytes

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • setTypeRenamer

      public static UnaryOperator<String> setTypeRenamer(UnaryOperator<String> typeRenamer)
      Set a type renamer that returns a renamed type string or returns null if no renaming is needed.

      Parameters:
      typeRenamer - type renaming algorithm
      Returns:
      previous typeRenamer
      ImplNote:
      static state is used over instance state because the virtual methods that execute the type renaming are called in the super constructor, which must occur before subclass instance state is initialized.
    • resolveClassDescriptorOverride

      protected ObjectStreamClass resolveClassDescriptorOverride(@NotNull ObjectStreamClass input) throws ClassNotFoundException
      Overrides:
      resolveClassDescriptorOverride in class com.fishlib.dataobjects.persistence.WObjectInputStream
      Throws:
      ClassNotFoundException
    • getReaderForType

      protected com.fishlib.dataobjects.persistence.WObjectInputStream.ObjectConverter getReaderForType(@NotNull String typeString) throws ClassNotFoundException
      There are a few different paths within WObjectInputStream that resolve packages to real classes, this one handles the path when the object is plainly encoded in the stream.
      Overrides:
      getReaderForType in class com.fishlib.dataobjects.persistence.WObjectInputStream
      Parameters:
      typeString - the input type being read
      Returns:
      an WObjectInputStream.ObjectConverter
      Throws:
      ClassNotFoundException - if the conversion was not possible