Class TypeHolder<T>

java.lang.Object
io.servicetalk.serialization.api.TypeHolder<T>
Type Parameters:
T - Type to be inferred.

@Deprecated public abstract class TypeHolder<T> extends Object
Deprecated.
General Type serialization is not supported by all serializers. Defer to your specific Serializer implementation. For example jackson offers TypeReference which can be used directly.
An abstract class to infer ParameterizedTypes for a child class. This type can be retrieved from type().

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 Details

    • TypeHolder

      protected TypeHolder()
      Deprecated.
      Creates a new instance.
  • Method Details

    • type

      public final Type type()
      Deprecated.
      Returns the inferred generic type for this TypeHolder.
      Returns:
      Inferred generic type for this TypeHolder.