Class TypeRef<T>

java.lang.Object
io.restassured.common.mapper.TypeRef<T>
Type Parameters:
T - The type
All Implemented Interfaces:
Comparable<TypeRef<T>>

public abstract class TypeRef<T> extends Object implements Comparable<TypeRef<T>>
Used to specify generic type information when de-serializing a Response.
 TypeRef ref = new TypeRef<List<Map<String, Integer>>() { };
 
Code is heavily inspired by (some might even say copied), from the JsonPath project.
  • Field Details

    • type

      protected final Type type
  • Constructor Details

    • TypeRef

      protected TypeRef()
  • Method Details

    • getType

      public Type getType()
    • getTypeAsClass

      public Class<T> getTypeAsClass()
    • compareTo

      public int compareTo(TypeRef<T> ignored)
      The only reason we define this method (and require implementation of Comparable) is to prevent constructing a reference without type information.
      Specified by:
      compareTo in interface Comparable<T>