public class EnumType<T> extends Base<Codec> implements Codec
This implements an enum, that based on the value wraps a different type. It is effectively an extension to enum where the value type is determined by the actual index.
Modifier and Type | Class and Description |
---|---|
static interface |
EnumType.EnumConstructor<T extends Codec> |
Constructor and Description |
---|
EnumType(Types.ConstructorDef def,
java.lang.Object value,
int index,
java.util.LinkedHashMap<java.lang.String,java.lang.String> aliasses) |
Modifier and Type | Method and Description |
---|---|
boolean |
eq(java.lang.Object other)
Compares the value of the input to see if there is a match
|
int |
getEncodedLength()
The length of the value when encoded as a Uint8Array
|
java.lang.String |
getType()
The name of the type this enum value represents
|
int |
index()
The index of the metadata value
|
boolean |
isEmpty()
Checks if the value is an empty value
|
boolean |
isNone()
Checks if the Enum points to a
Null type |
boolean |
isNull()
Checks if the Enum points to a
Null type (deprecated, use isNone) |
boolean |
isType(java.lang.String value) |
java.lang.String |
toHex()
Returns a hex string representation of the value
|
java.lang.Object |
toJson()
Converts the Object to JSON, typically used for RPC transfers
|
int |
toNumber()
Returns the number representation for the value
|
java.lang.String |
toString()
Returns the string representation of the value
|
byte[] |
toU8a(boolean isBare)
Encodes the value as a Uint8Array as per the parity-codec specifications
|
Codec |
value()
The value of the enum
|
static Types.ConstructorCodec<EnumType> |
with(Types.ConstructorDef def) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getConstructorCodec, toU8a
public EnumType(Types.ConstructorDef def, java.lang.Object value, int index, java.util.LinkedHashMap<java.lang.String,java.lang.String> aliasses)
public static Types.ConstructorCodec<EnumType> with(Types.ConstructorDef def)
public int toNumber()
Returns the number representation for the value
public Codec value()
The value of the enum
public java.lang.String getType()
The name of the type this enum value represents
public int index()
The index of the metadata value
public boolean isNull()
Checks if the Enum points to a Null
type (deprecated, use isNone)
public int getEncodedLength()
The length of the value when encoded as a Uint8Array
getEncodedLength
in interface Codec
public boolean isEmpty()
Checks if the value is an empty value
public boolean isNone()
Checks if the Enum points to a Null
type
public boolean eq(java.lang.Object other)
Compares the value of the input to see if there is a match
public java.lang.String toHex()
Returns a hex string representation of the value
public java.lang.Object toJson()
Converts the Object to JSON, typically used for RPC transfers
public java.lang.String toString()
Returns the string representation of the value
toString
in class java.lang.Object
public byte[] toU8a(boolean isBare)
Encodes the value as a Uint8Array as per the parity-codec specifications
public boolean isType(java.lang.String value)