()
| 25 | private final Type type; |
| 26 | |
| 27 | public TypeToken() { |
| 28 | Type superclass = getClass().getGenericSuperclass(); |
| 29 | if (!(superclass instanceof ParameterizedType)) { |
| 30 | throw new IllegalStateException(String.format("%s isn't parameterized", superclass)); |
| 31 | } |
| 32 | type = ((ParameterizedType) superclass).getActualTypeArguments()[0]; |
| 33 | } |
| 34 | |
| 35 | public Type getType() { |
| 36 | return type; |