Class TransactionMessage.Builder
- java.lang.Object
-
- com.exonum.binding.common.message.TransactionMessage.Builder
-
- Enclosing interface:
- TransactionMessage
public static class TransactionMessage.Builder extends java.lang.Object
Builder for the binary transaction message.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TransactionMessage.Builder
payload(byte[] payload)
Sets payload to the transaction message.TransactionMessage.Builder
payload(java.nio.ByteBuffer payload)
Sets payload to the transaction message.TransactionMessage.Builder
serviceId(short serviceId)
Sets service identifier to the transaction message.TransactionMessage
sign(KeyPair keys, CryptoFunction crypto)
Signs the message, creating a new signed binary transaction message.TransactionMessage.Builder
transactionId(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(java.nio.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:
java.lang.NullPointerException
- if serviceId or transactionId or payload weren't setjava.lang.IllegalArgumentException
- if public key has wrong size
-
-