public abstract class TypeReference<T extends Type> extends java.lang.Object implements java.lang.Comparable<TypeReference<T>>
Array
types.
See this blog post for further details.
It may make sense to switch to using Java's reflection Type to avoid working around this fundamental generics limitation.
Modifier and Type | Class and Description |
---|---|
static class |
TypeReference.StaticArrayTypeReference<T extends Type> |
Modifier and Type | Field and Description |
---|---|
protected static java.util.regex.Pattern |
ARRAY_SUFFIX |
Modifier | Constructor and Description |
---|---|
protected |
TypeReference() |
protected |
TypeReference(boolean indexed) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(TypeReference<T> o) |
static <T extends Type> |
create(java.lang.Class<T> cls) |
static <T extends Type> |
create(java.lang.Class<T> cls,
boolean indexed) |
protected static java.lang.Class<? extends Type> |
getAtomicTypeClass(java.lang.String solidityType,
boolean primitives)
This is a helper method that only works for atomic types (uint, bytes, etc).
|
java.lang.Class<T> |
getClassType()
Workaround to ensure type does not come back as T due to erasure, this enables you to create
a TypeReference via
Class<T> . |
java.lang.reflect.Type |
getType() |
boolean |
isIndexed() |
static TypeReference |
makeTypeReference(java.lang.String solidityType) |
static TypeReference |
makeTypeReference(java.lang.String solidityType,
boolean indexed,
boolean primitives) |
protected TypeReference()
protected TypeReference(boolean indexed)
public int compareTo(TypeReference<T> o)
compareTo
in interface java.lang.Comparable<TypeReference<T extends Type>>
public java.lang.reflect.Type getType()
public boolean isIndexed()
public java.lang.Class<T> getClassType() throws java.lang.ClassNotFoundException
Class<T>
.java.lang.ClassNotFoundException
- if the class type cannot be determinedpublic static <T extends Type> TypeReference<T> create(java.lang.Class<T> cls)
public static <T extends Type> TypeReference<T> create(java.lang.Class<T> cls, boolean indexed)
protected static java.lang.Class<? extends Type> getAtomicTypeClass(java.lang.String solidityType, boolean primitives) throws java.lang.ClassNotFoundException
ParameterizedType
.solidityType
- the solidity as a string eg Address Intprimitives
- is it a primitive typejava.lang.ClassNotFoundException
- when the class cannot be found.public static TypeReference makeTypeReference(java.lang.String solidityType) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public static TypeReference makeTypeReference(java.lang.String solidityType, boolean indexed, boolean primitives) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException