Class ProxySerializer

java.lang.Object
io.fluxcapacitor.proxy.ProxySerializer
All Implemented Interfaces:
ContentFilter, Serializer

public class ProxySerializer extends Object implements Serializer
  • Constructor Details

    • ProxySerializer

      public ProxySerializer()
  • Method Details

    • serialize

      public Data<byte[]> serialize(Object object, String format)
      Description copied from interface: Serializer
      Serializes the given object into a Data wrapper using the specified format.
      Specified by:
      serialize in interface Serializer
      Parameters:
      object - the object to serialize
      format - the desired serialization format (e.g. \"json\"); may be null
      Returns:
      serialized object as Data
    • deserialize

      public <I extends SerializedObject<byte[]>> Stream<DeserializingObject<byte[],I>> deserialize(Stream<I> stream, UnknownTypeStrategy unknownTypeStrategy)
      Description copied from interface: Serializer
      Upcasts and deserializes a stream of serialized objects. Each result in the output stream contains both a provider for the deserialized object and the serialized object after upcasting that is used as the source of the deserialized object.

      Deserialization is performed lazily. This means that actual conversion for a given result in the output stream only happens if DeserializingObject.getPayload() is invoked on the result. This has the advantage that a caller can inspect what type will be returned via

      invalid reference
      DeserializingObject#getSerializedObject()
      before deciding to go through with the deserialization.

      You can specify whether deserialization of a result in the output stream should fail with a DeserializationException if a type is unknown (not a class). It is up to the implementation to determine what should happen if a type is unknown but the failOnUnknownType flag is false.

      Specified by:
      deserialize in interface Serializer
      Type Parameters:
      I - the type of the serialized object
      Parameters:
      stream - data input stream to deserialize
      unknownTypeStrategy - value that determines what to do when encountering unknown types
      Returns:
      a stream containing deserialization results
    • convert

      public <V> V convert(Object o, Type aClass)
      Description copied from interface: Serializer
      Converts a given object to another type using the serializer's object mapping rules.
      Specified by:
      convert in interface Serializer
      Type Parameters:
      V - the result type
      Parameters:
      o - the input value
      aClass - the target type
      Returns:
      the converted value
    • clone

      public <V> V clone(Object o)
      Description copied from interface: Serializer
      Creates a deep copy of the given object using serialization.
      Specified by:
      clone in interface Serializer
      Type Parameters:
      V - the type of the value
      Parameters:
      o - the object to clone
      Returns:
      a deep copy
    • registerUpcasters

      public Registration registerUpcasters(Object... casterCandidates)
      Description copied from interface: Serializer
      Registers one or more upcaster candidates.
      Specified by:
      registerUpcasters in interface Serializer
      Parameters:
      casterCandidates - beans with upcasting logic
      Returns:
      a registration handle
    • registerDowncasters

      public Registration registerDowncasters(Object... casterCandidates)
      Description copied from interface: Serializer
      Registers one or more downcaster candidates.
      Specified by:
      registerDowncasters in interface Serializer
      Parameters:
      casterCandidates - beans with downcasting logic
      Returns:
      a registration handle
    • registerTypeCaster

      public Registration registerTypeCaster(String s, String s1)
      Description copied from interface: Serializer
      Registers a mapping from an old type identifier to a new one.
      Specified by:
      registerTypeCaster in interface Serializer
      Parameters:
      s - the legacy type name
      s1 - the canonical or updated type name
      Returns:
      a registration handle
    • upcastType

      public String upcastType(String s)
      Description copied from interface: Serializer
      Returns the upcasted type name for a legacy type identifier.
      Specified by:
      upcastType in interface Serializer
      Parameters:
      s - the original type
      Returns:
      the remapped (or unchanged) type name
    • downcast

      public Object downcast(Object o, int i)
      Description copied from interface: Serializer
      Downcasts the given object to a previous revision.
      Specified by:
      downcast in interface Serializer
      Parameters:
      o - the object to downcast
      i - the target revision
      Returns:
      a revisioned form of the object
    • downcast

      public Object downcast(Data<?> data, int i)
      Description copied from interface: Serializer
      Downcasts a Data object to the specified revision level.
      Specified by:
      downcast in interface Serializer
      Parameters:
      data - the serialized data
      i - the target revision number
      Returns:
      a transformed object matching the older revision
    • filterContent

      public <T> T filterContent(T t, User user)
      Description copied from interface: ContentFilter
      Filters the given value based on the current viewer (user) context. If a FilterContent handler exists in the object's class, it will be invoked to produce a user-specific view of the data.
      Specified by:
      filterContent in interface ContentFilter
      Type Parameters:
      T - the type of the content object
      Parameters:
      t - the original object
      user - the user viewing the content
      Returns:
      the filtered version of the object, or the original object if filtering failed or was not applicable