Class S3EventSerializer<T>

java.lang.Object
com.amazonaws.services.lambda.runtime.serialization.events.serializers.S3EventSerializer<T>
All Implemented Interfaces:
OrgJsonSerializer<T>, PojoSerializer<T>

public class S3EventSerializer<T> extends Object implements OrgJsonSerializer<T>
Serializer for S3 event NOTE: Because the s3 event class provided by the SDK does not play well with Jackson through a class laoder, this class uses the low level org json library to serialize and deserialize the event. If new events are added that do not work well with Jackson or GSON, this is the fallback method that will always work but is more verbose.
  • Constructor Details

    • S3EventSerializer

      public S3EventSerializer()
  • Method Details

    • withClass

      public S3EventSerializer<T> withClass(Class<T> eventClass)
      Construct s3Event Serialize from specific s3 event class from user
      Specified by:
      withClass in interface OrgJsonSerializer<T>
      Parameters:
      eventClass - s3 event class
      Returns:
      OrgJsonSerializer with event type
    • withClassLoader

      public S3EventSerializer<T> withClassLoader(ClassLoader classLoader)
      Sets the ClassLoader that will be used to load S3 event classes
      Specified by:
      withClassLoader in interface OrgJsonSerializer<T>
      Parameters:
      classLoader - - ClassLoader that S3 event classes will be loaded from
      Returns:
      OrgJsonSerializer with the supplied classLoader
    • fromJson

      public T fromJson(InputStream input)
      deserialize an instance of an s3 event from an input stream
      Specified by:
      fromJson in interface OrgJsonSerializer<T>
      Specified by:
      fromJson in interface PojoSerializer<T>
      Parameters:
      input - InputStream reading from
      Returns:
      S3Event Object
    • fromJson

      public T fromJson(String input)
      deserialize an instance of an s3 event from a string
      Specified by:
      fromJson in interface OrgJsonSerializer<T>
      Specified by:
      fromJson in interface PojoSerializer<T>
      Parameters:
      input - String with JSON
      Returns:
      s3Event object
    • toJson

      public void toJson(T value, OutputStream output)
      serialize an S3 event object to the output stream
      Specified by:
      toJson in interface OrgJsonSerializer<T>
      Specified by:
      toJson in interface PojoSerializer<T>
      Parameters:
      value - S3 event object
      output - OutputStream serializing to