Package org.stellar.sdk.xdr
Class SCVal
java.lang.Object
org.stellar.sdk.xdr.SCVal
- All Implemented Interfaces:
XdrElement
SCVal's original definition in the XDR file is:
union SCVal switch (SCValType type)
{
case SCV_BOOL:
bool b;
case SCV_VOID:
void;
case SCV_ERROR:
SCError error;
case SCV_U32:
uint32 u32;
case SCV_I32:
int32 i32;
case SCV_U64:
uint64 u64;
case SCV_I64:
int64 i64;
case SCV_TIMEPOINT:
TimePoint timepoint;
case SCV_DURATION:
Duration duration;
case SCV_U128:
UInt128Parts u128;
case SCV_I128:
Int128Parts i128;
case SCV_U256:
UInt256Parts u256;
case SCV_I256:
Int256Parts i256;
case SCV_BYTES:
SCBytes bytes;
case SCV_STRING:
SCString str;
case SCV_SYMBOL:
SCSymbol sym;
// Vec and Map are recursive so need to live
// behind an option, due to xdrpp limitations.
case SCV_VEC:
SCVec *vec;
case SCV_MAP:
SCMap *map;
case SCV_ADDRESS:
SCAddress address;
// Special SCVals reserved for system-constructed contract-data
// ledger keys, not generally usable elsewhere.
case SCV_CONTRACT_INSTANCE:
SCContractInstance instance;
case SCV_LEDGER_KEY_CONTRACT_INSTANCE:
void;
case SCV_LEDGER_KEY_NONCE:
SCNonceKey nonce_key;
};
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface org.stellar.sdk.xdr.XdrElement
gson -
Constructor Summary
ConstructorsConstructorDescriptionSCVal()SCVal(SCValType discriminant, Boolean b, SCError error, Uint32 u32, Int32 i32, Uint64 u64, Int64 i64, TimePoint timepoint, Duration duration, UInt128Parts u128, Int128Parts i128, UInt256Parts u256, Int256Parts i256, SCBytes bytes, SCString str, SCSymbol sym, SCVec vec, SCMap map, SCAddress address, SCContractInstance instance, SCNonceKey nonce_key) Creates a newSCValinstance. -
Method Summary
Modifier and TypeMethodDescriptionstatic SCVal.SCValBuilderbuilder()static SCValdecode(XdrDataInputStream stream) static SCValdecode(XdrDataInputStream stream, int maxDepth) voidencode(XdrDataOutputStream stream) Encodes this value to XDR and writes it to the provided stream.booleanstatic SCValstatic SCValfromXdrBase64(String xdr) static SCValfromXdrByteArray(byte[] xdr) Value of theaddressfield.getB()Value of thebfield.getBytes()Value of thebytesfield.Value of thediscriminantfield.Value of thedurationfield.getError()Value of theerrorfield.getI128()Value of thei128field.getI256()Value of thei256field.getI32()Value of thei32field.getI64()Value of thei64field.Value of theinstancefield.getMap()Value of themapfield.Value of thenonce_keyfield.getStr()Value of thestrfield.getSym()Value of thesymfield.Value of thetimepointfield.getU128()Value of theu128field.getU256()Value of theu256field.getU32()Value of theu32field.getU64()Value of theu64field.getVec()Value of thevecfield.inthashCode()voidsetAddress(SCAddress address) Value of theaddressfield.voidValue of thebfield.voidValue of thebytesfield.voidsetDiscriminant(SCValType discriminant) Value of thediscriminantfield.voidsetDuration(Duration duration) Value of thedurationfield.voidValue of theerrorfield.voidsetI128(Int128Parts i128) Value of thei128field.voidsetI256(Int256Parts i256) Value of thei256field.voidValue of thei32field.voidValue of thei64field.voidsetInstance(SCContractInstance instance) Value of theinstancefield.voidValue of themapfield.voidsetNonce_key(SCNonceKey nonce_key) Value of thenonce_keyfield.voidValue of thestrfield.voidValue of thesymfield.voidsetTimepoint(TimePoint timepoint) Value of thetimepointfield.voidsetU128(UInt128Parts u128) Value of theu128field.voidsetU256(UInt256Parts u256) Value of theu256field.voidValue of theu32field.voidValue of theu64field.voidValue of thevecfield.toJson()Serializes this value to JSON.toString()Methods inherited from interface org.stellar.sdk.xdr.XdrElement
toXdrBase64, toXdrByteArray
-
Constructor Details
-
SCVal
public SCVal() -
SCVal
public SCVal(SCValType discriminant, Boolean b, SCError error, Uint32 u32, Int32 i32, Uint64 u64, Int64 i64, TimePoint timepoint, Duration duration, UInt128Parts u128, Int128Parts i128, UInt256Parts u256, Int256Parts i256, SCBytes bytes, SCString str, SCSymbol sym, SCVec vec, SCMap map, SCAddress address, SCContractInstance instance, SCNonceKey nonce_key) Creates a newSCValinstance.- Parameters:
discriminant- thediscriminantfield valueb- thebfield valueerror- theerrorfield valueu32- theu32field valuei32- thei32field valueu64- theu64field valuei64- thei64field valuetimepoint- thetimepointfield valueduration- thedurationfield valueu128- theu128field valuei128- thei128field valueu256- theu256field valuei256- thei256field valuebytes- thebytesfield valuestr- thestrfield valuesym- thesymfield valuevec- thevecfield valuemap- themapfield valueaddress- theaddressfield valueinstance- theinstancefield valuenonce_key- thenonce_keyfield value
-
-
Method Details
-
encode
Description copied from interface:XdrElementEncodes this value to XDR and writes it to the provided stream.- Specified by:
encodein interfaceXdrElement- Parameters:
stream- the destination XDR output stream- Throws:
IOException- if an I/O error occurs while writing the value
-
decode
- Throws:
IOException
-
decode
- Throws:
IOException
-
fromXdrBase64
- Throws:
IOException
-
fromXdrByteArray
- Throws:
IOException
-
toJson
Description copied from interface:XdrElementSerializes this value to JSON.- Specified by:
toJsonin interfaceXdrElement- Returns:
- the JSON representation of this value
-
fromJson
-
builder
-
toBuilder
-
getDiscriminant
Value of thediscriminantfield.- Returns:
- the
discriminantfield value
-
getB
Value of thebfield.- Returns:
- the
bfield value
-
getError
Value of theerrorfield.- Returns:
- the
errorfield value
-
getU32
Value of theu32field.- Returns:
- the
u32field value
-
getI32
Value of thei32field.- Returns:
- the
i32field value
-
getU64
Value of theu64field.- Returns:
- the
u64field value
-
getI64
Value of thei64field.- Returns:
- the
i64field value
-
getTimepoint
Value of thetimepointfield.- Returns:
- the
timepointfield value
-
getDuration
Value of thedurationfield.- Returns:
- the
durationfield value
-
getU128
Value of theu128field.- Returns:
- the
u128field value
-
getI128
Value of thei128field.- Returns:
- the
i128field value
-
getU256
Value of theu256field.- Returns:
- the
u256field value
-
getI256
Value of thei256field.- Returns:
- the
i256field value
-
getBytes
Value of thebytesfield.- Returns:
- the
bytesfield value
-
getStr
Value of thestrfield.- Returns:
- the
strfield value
-
getSym
Value of thesymfield.- Returns:
- the
symfield value
-
getVec
Value of thevecfield.- Returns:
- the
vecfield value
-
getMap
Value of themapfield.- Returns:
- the
mapfield value
-
getAddress
Value of theaddressfield.- Returns:
- the
addressfield value
-
getInstance
Value of theinstancefield.- Returns:
- the
instancefield value
-
getNonce_key
Value of thenonce_keyfield.- Returns:
- the
nonce_keyfield value
-
setDiscriminant
Value of thediscriminantfield.- Parameters:
discriminant- thediscriminantfield value
-
setB
Value of thebfield.- Parameters:
b- thebfield value
-
setError
Value of theerrorfield.- Parameters:
error- theerrorfield value
-
setU32
Value of theu32field.- Parameters:
u32- theu32field value
-
setI32
Value of thei32field.- Parameters:
i32- thei32field value
-
setU64
Value of theu64field.- Parameters:
u64- theu64field value
-
setI64
Value of thei64field.- Parameters:
i64- thei64field value
-
setTimepoint
Value of thetimepointfield.- Parameters:
timepoint- thetimepointfield value
-
setDuration
Value of thedurationfield.- Parameters:
duration- thedurationfield value
-
setU128
Value of theu128field.- Parameters:
u128- theu128field value
-
setI128
Value of thei128field.- Parameters:
i128- thei128field value
-
setU256
Value of theu256field.- Parameters:
u256- theu256field value
-
setI256
Value of thei256field.- Parameters:
i256- thei256field value
-
setBytes
Value of thebytesfield.- Parameters:
bytes- thebytesfield value
-
setStr
Value of thestrfield.- Parameters:
str- thestrfield value
-
setSym
Value of thesymfield.- Parameters:
sym- thesymfield value
-
setVec
Value of thevecfield.- Parameters:
vec- thevecfield value
-
setMap
Value of themapfield.- Parameters:
map- themapfield value
-
setAddress
Value of theaddressfield.- Parameters:
address- theaddressfield value
-
setInstance
Value of theinstancefield.- Parameters:
instance- theinstancefield value
-
setNonce_key
Value of thenonce_keyfield.- Parameters:
nonce_key- thenonce_keyfield value
-
equals
-
hashCode
public int hashCode() -
toString
-