Package io.modelcontextprotocol.json
Class TypeRef<T>
java.lang.Object
io.modelcontextprotocol.json.TypeRef<T>
Captures generic type information at runtime for parameterized JSON (de)serialization.
Usage: TypeRef<List> ref = new TypeRef<>(){};
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTypeRef()Constructs a new TypeRef instance, capturing the generic type information of the subclass. -
Method Summary
-
Constructor Details
-
TypeRef
protected TypeRef()Constructs a new TypeRef instance, capturing the generic type information of the subclass. This constructor should be called from an anonymous subclass to capture the actual type arguments. For example:TypeRef<List<Foo>> ref = new TypeRef<>(){};- Throws:
IllegalStateException- if TypeRef is not subclassed with actual type information
-
-
Method Details
-
getType
Returns the captured type information.- Returns:
- the Type representing the actual type argument captured by this TypeRef instance
-