Package org.xrpl.xrpl4j.wallet
Class ImmutableWallet
- java.lang.Object
-
- org.xrpl.xrpl4j.wallet.ImmutableWallet
-
- All Implemented Interfaces:
Wallet
@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableWallet extends Object implements Wallet
Immutable implementation ofWallet
.Use the builder to create immutable instances:
ImmutableWallet.builder()
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ImmutableWallet.Builder
Builds instances of typeImmutableWallet
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableWallet.Builder
builder()
Creates a builder forImmutableWallet
.Address
classicAddress()
The XRPL address of this wallet, in the Classic Address form.static ImmutableWallet
copyOf(Wallet instance)
Creates an immutable copy of aWallet
value.boolean
equals(Object another)
This instance is equal to all instances ofImmutableWallet
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:privateKey
,publicKey
,classicAddress
,xAddress
,isTest
.boolean
isTest()
Whether or not this wallet is on XRPL testnet or mainnet.Optional<String>
privateKey()
The private key of the wallet, encoded in hexadecimal.String
publicKey()
The public key of the wallet, encoded in hexadecimal.String
toString()
Prints the immutable valueWallet
with attribute values.ImmutableWallet
withClassicAddress(Address value)
Copy the current immutable object by setting a value for theclassicAddress
attribute.ImmutableWallet
withIsTest(boolean value)
Copy the current immutable object by setting a value for theisTest
attribute.ImmutableWallet
withPrivateKey(String value)
Copy the current immutable object by setting a present value for the optionalprivateKey
attribute.ImmutableWallet
withPrivateKey(Optional<String> optional)
Copy the current immutable object by setting an optional value for theprivateKey
attribute.ImmutableWallet
withPublicKey(String value)
Copy the current immutable object by setting a value for thepublicKey
attribute.ImmutableWallet
withXAddress(String value)
Copy the current immutable object by setting a value for thexAddress
attribute.String
xAddress()
The XRPL address of this wallet, in the X-Address form.
-
-
-
Method Detail
-
privateKey
public Optional<String> privateKey()
The private key of the wallet, encoded in hexadecimal.- Specified by:
privateKey
in interfaceWallet
- Returns:
- An optionally present
String
containing a private key.
-
publicKey
public String publicKey()
The public key of the wallet, encoded in hexadecimal.
-
classicAddress
public Address classicAddress()
The XRPL address of this wallet, in the Classic Address form.- Specified by:
classicAddress
in interfaceWallet
- Returns:
- The classic
Address
of this wallet.
-
xAddress
public String xAddress()
The XRPL address of this wallet, in the X-Address form.
-
isTest
public boolean isTest()
Whether or not this wallet is on XRPL testnet or mainnet.
-
withPrivateKey
public final ImmutableWallet withPrivateKey(String value)
Copy the current immutable object by setting a present value for the optionalprivateKey
attribute.- Parameters:
value
- The value for privateKey- Returns:
- A modified copy of
this
object
-
withPrivateKey
public final ImmutableWallet withPrivateKey(Optional<String> optional)
Copy the current immutable object by setting an optional value for theprivateKey
attribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis
.- Parameters:
optional
- A value for privateKey- Returns:
- A modified copy of
this
object
-
withPublicKey
public final ImmutableWallet withPublicKey(String value)
Copy the current immutable object by setting a value for thepublicKey
attribute. An equals check used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for publicKey- Returns:
- A modified copy of the
this
object
-
withClassicAddress
public final ImmutableWallet withClassicAddress(Address value)
Copy the current immutable object by setting a value for theclassicAddress
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for classicAddress- Returns:
- A modified copy of the
this
object
-
withXAddress
public final ImmutableWallet withXAddress(String value)
Copy the current immutable object by setting a value for thexAddress
attribute. An equals check used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for xAddress- Returns:
- A modified copy of the
this
object
-
withIsTest
public final ImmutableWallet withIsTest(boolean value)
Copy the current immutable object by setting a value for theisTest
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for isTest- Returns:
- A modified copy of the
this
object
-
equals
public boolean equals(@Nullable Object another)
This instance is equal to all instances ofImmutableWallet
that have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:privateKey
,publicKey
,classicAddress
,xAddress
,isTest
.
-
toString
public String toString()
Prints the immutable valueWallet
with attribute values.
-
copyOf
public static ImmutableWallet copyOf(Wallet instance)
Creates an immutable copy of aWallet
value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance
- The instance to copy- Returns:
- A copied immutable Wallet instance
-
builder
public static ImmutableWallet.Builder builder()
Creates a builder forImmutableWallet
.ImmutableWallet.builder() .privateKey(String) // optional
privateKey
.publicKey(String) // requiredpublicKey
.classicAddress(org.xrpl.xrpl4j.model.transactions.Address) // requiredclassicAddress
.xAddress(String) // requiredxAddress
.isTest(boolean) // requiredisTest
.build();- Returns:
- A new ImmutableWallet builder
-
-