Class TransactionMessage.Builder
- java.lang.Object
-
- com.exonum.binding.common.message.TransactionMessage.Builder
-
- Enclosing interface:
- TransactionMessage
public static class TransactionMessage.Builder extends Object
Builder for the binary transaction message.
-
-
Method Summary
Modifier and Type Method Description TransactionMessage.Builderpayload(byte[] payload)Sets payload to the transaction message.TransactionMessage.Builderpayload(ByteBuffer payload)Sets payload to the transaction message.TransactionMessage.BuilderserviceId(short serviceId)Sets service identifier to the transaction message.TransactionMessagesign(KeyPair keys, CryptoFunction crypto)Signs the message, creating a new signed binary transaction message.TransactionMessage.BuildertransactionId(short transactionId)Sets transaction identifier to the transaction message.
-
-
-
Method Detail
-
serviceId
public TransactionMessage.Builder serviceId(short serviceId)
Sets service identifier to the transaction message.
-
transactionId
public TransactionMessage.Builder transactionId(short transactionId)
Sets transaction identifier to the transaction message.
-
payload
public TransactionMessage.Builder payload(byte[] payload)
Sets payload to the transaction message.
-
payload
public TransactionMessage.Builder payload(ByteBuffer payload)
Sets payload to the transaction message.
-
sign
public TransactionMessage sign(KeyPair keys, CryptoFunction crypto)
Signs the message, creating a new signed binary transaction message.- Parameters:
keys- key pair with private and public keys. Public key is used as an author key of the message and private key is used for signing the message.crypto- a cryptographic function to use- Returns:
- a new signed binary transaction message
- Throws:
NullPointerException- if serviceId or transactionId or payload weren't setIllegalArgumentException- if public key has wrong size
-
-