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 Summary
Constructors Constructor Description S3EventSerializer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
fromJson(InputStream input)
deserialize an instance of an s3 event from an input streamT
fromJson(String input)
deserialize an instance of an s3 event from a stringvoid
toJson(T value, OutputStream output)
serialize an S3 event object to the output streamS3EventSerializer<T>
withClass(Class<T> eventClass)
Construct s3Event Serialize from specific s3 event class from userS3EventSerializer<T>
withClassLoader(ClassLoader classLoader)
Sets the ClassLoader that will be used to load S3 event classes
-
-
-
Method Detail
-
withClass
public S3EventSerializer<T> withClass(Class<T> eventClass)
Construct s3Event Serialize from specific s3 event class from user- Specified by:
withClass
in interfaceOrgJsonSerializer<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 interfaceOrgJsonSerializer<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 interfaceOrgJsonSerializer<T>
- Specified by:
fromJson
in interfacePojoSerializer<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 interfaceOrgJsonSerializer<T>
- Specified by:
fromJson
in interfacePojoSerializer<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 interfaceOrgJsonSerializer<T>
- Specified by:
toJson
in interfacePojoSerializer<T>
- Parameters:
value
- S3 event objectoutput
- OutputStream serializing to
-
-