Package io.servicetalk.serialization.api
Class TypeHolder<T>
- java.lang.Object
-
- io.servicetalk.serialization.api.TypeHolder<T>
-
- Type Parameters:
T
- Type to be inferred.
public abstract class TypeHolder<T> extends java.lang.Object
An abstract class to inferParameterizedType
s for a child class. This type can be retrieved fromtype()
.In order to use this, one has to create an anonymous sub-class, like:
TypeHolder<Set<String>> holder = new TypeHolder<Set<String>>() { };
This implementation is based on the samples provided in this article..
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TypeHolder()
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.reflect.Type
type()
Returns the inferred generic type for thisTypeHolder
.
-
-
-
Method Detail
-
type
public final java.lang.reflect.Type type()
Returns the inferred generic type for thisTypeHolder
.- Returns:
- Inferred generic type for this
TypeHolder
.
-
-