Class GenericType<T>

java.lang.Object
jakarta.ws.rs.core.GenericType<T>
Type Parameters:
T - the generic type parameter.

public class GenericType<T> extends Object
Represents a generic message entity type T. Supports in-line instantiation of objects that represent generic types with actual type parameters. An object that represents any parameterized type may be obtained by sub-classing GenericType. Alternatively, an object representing a concrete parameterized type can be created using a GenericType(java.lang.reflect.Type) and manually specifying the actual (parameterized) type.

For example:

 GenericType<List<String>> stringListType = new GenericType<List<String>>() {
 };
 

Or:

  public class MyGenericType extends GenericType<List<String>> { ... }

  ...

  MyGenericType stringListType = new MyGenericType();
 

Note that due to the Java type erasure limitations the parameterized type information must be specified on a subclass, not just during the instance creation. For example, the following case would throw an IllegalArgumentException:

  public class MyGenericType<T> extends GenericType<T> { ... }

  ...

  // The type is only specified on instance, not in a sub-class
  MyGenericType<List<String>> stringListType =
          new MyGenericType<List<String>>();
 
Since:
2.0