public class TypeDecoder
extends java.lang.Object
The public API is composed of "decode*" methods and provides backward-compatibility. See https://github.com/hyperledger/web3j/issues/1591 for a discussion about decoding and possible improvements.
| Constructor and Description |
|---|
TypeDecoder() |
| Modifier and Type | Method and Description |
|---|---|
static <T extends Array> |
decode(java.lang.String input,
int offset,
TypeReference<T> typeReference)
Broken as inherited from web3j — every call throws.
|
static <T extends Type> |
decode(java.lang.String input,
TypeReference<?> type) |
static Address |
decodeAddress(java.lang.String input) |
static Bool |
decodeBool(java.lang.String rawInput,
int offset) |
static <T extends Bytes> |
decodeBytes(java.lang.String input,
java.lang.Class<T> type) |
static <T extends Bytes> |
decodeBytes(java.lang.String input,
int offset,
java.lang.Class<T> type) |
static <T extends Type> |
decodeDynamicArray(java.lang.String input,
int offset,
TypeReference<T> typeReference) |
static DynamicBytes |
decodeDynamicBytes(java.lang.String input,
int offset) |
static <T extends Type> |
decodeDynamicStruct(java.lang.String input,
int offset,
TypeReference<T> typeReference) |
static <T extends NumericType> |
decodeNumeric(java.lang.String input,
java.lang.Class<T> type) |
static <T extends Type> |
decodeStaticStruct(java.lang.String input,
int offset,
TypeReference<T> typeReference) |
static Utf8String |
decodeUtf8String(java.lang.String input,
int offset) |
static Type |
instantiateType(java.lang.String solidityType,
java.lang.Object value) |
static Type |
instantiateType(TypeReference ref,
java.lang.Object value) |
public static Type instantiateType(java.lang.String solidityType, java.lang.Object value) throws java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException
java.lang.reflect.InvocationTargetExceptionjava.lang.NoSuchMethodExceptionjava.lang.InstantiationExceptionjava.lang.IllegalAccessExceptionjava.lang.ClassNotFoundExceptionpublic static Type instantiateType(TypeReference ref, java.lang.Object value) throws java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.lang.InstantiationException, java.lang.ClassNotFoundException
java.lang.NoSuchMethodExceptionjava.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetExceptionjava.lang.InstantiationExceptionjava.lang.ClassNotFoundExceptionpublic static <T extends Array> T decode(java.lang.String input, int offset, TypeReference<T> typeReference)
getRawType().getClass()
below always yields java.lang.Class (the class of the Class object, not the
raw type itself), so both isAssignableFrom branches are unreachable and any
input falls through to UnsupportedOperationException. Nothing in this SDK
calls this overload; use decodeStaticArray(java.lang.String, int, org.tron.trident.abi.TypeReference<T>, int) / decodeDynamicArray(java.lang.String, int, org.tron.trident.abi.TypeReference<T>)
directly instead. Kept unfixed to stay aligned with upstream; the fix would be
(Class) ...getRawType() plus end-to-end verification of the StaticArray
branch (note its hardcoded length argument of 1).public static <T extends Type> T decode(java.lang.String input, TypeReference<?> type) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundExceptionpublic static Address decodeAddress(java.lang.String input)
public static <T extends NumericType> T decodeNumeric(java.lang.String input, java.lang.Class<T> type)
public static Bool decodeBool(java.lang.String rawInput, int offset)
public static <T extends Bytes> T decodeBytes(java.lang.String input, java.lang.Class<T> type)
public static <T extends Bytes> T decodeBytes(java.lang.String input, int offset, java.lang.Class<T> type)
public static DynamicBytes decodeDynamicBytes(java.lang.String input, int offset)
public static Utf8String decodeUtf8String(java.lang.String input, int offset)
public static <T extends Type> T decodeStaticStruct(java.lang.String input, int offset, TypeReference<T> typeReference)
public static <T extends Type> T decodeDynamicArray(java.lang.String input, int offset, TypeReference<T> typeReference)
public static <T extends Type> T decodeDynamicStruct(java.lang.String input, int offset, TypeReference<T> typeReference) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException