Package software.amazon.lambda.durable
Class TypeToken<T>
java.lang.Object
software.amazon.lambda.durable.TypeToken<T>
- Type Parameters:
T- the type being captured
Framework-agnostic type token for capturing generic type information at runtime.
This class enables type-safe deserialization of complex generic types like List<MyObject> or
Map<String, MyObject> that would otherwise lose their type information due to Java's type erasure.
Usage example:
// Capture generic type information
TypeToken<List<String>> token = new TypeToken<List<String>>() {};
// Use with DurableContext
List<String> items = context.step("fetch-items",
new TypeToken<List<String>>() {},
stepCtx -> fetchItems());
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
TypeToken
protected TypeToken()Constructs a new TypeToken. This constructor must be called from an anonymous subclass to capture the type parameter.- Throws:
IllegalStateException- if created without a type parameter
-
-
Method Details