- java.lang.Object
-
- com.tigerbeetle.Batch
-
- com.tigerbeetle.TransferBatch
-
public final class TransferBatch extends Batch
-
-
Constructor Summary
Constructors Constructor Description TransferBatch(int capacity)
Creates an empty batch with the desired maximum capacity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getAmount()
int
getCode()
byte[]
getCreditAccountId()
long
getCreditAccountId(UInt128 part)
byte[]
getDebitAccountId()
long
getDebitAccountId(UInt128 part)
int
getFlags()
byte[]
getId()
long
getId(UInt128 part)
int
getLedger()
byte[]
getPendingId()
long
getPendingId(UInt128 part)
long
getTimeout()
long
getTimestamp()
byte[]
getUserData()
long
getUserData(UInt128 part)
void
setAmount(long amount)
void
setCode(int code)
void
setCreditAccountId(byte[] creditAccountId)
void
setCreditAccountId(long leastSignificant)
void
setCreditAccountId(long leastSignificant, long mostSignificant)
void
setDebitAccountId(byte[] debitAccountId)
void
setDebitAccountId(long leastSignificant)
void
setDebitAccountId(long leastSignificant, long mostSignificant)
void
setFlags(int flags)
void
setId(byte[] id)
void
setId(long leastSignificant)
void
setId(long leastSignificant, long mostSignificant)
void
setLedger(int ledger)
void
setPendingId(byte[] pendingId)
void
setPendingId(long leastSignificant)
void
setPendingId(long leastSignificant, long mostSignificant)
void
setTimeout(long timeout)
void
setUserData(byte[] userData)
void
setUserData(long leastSignificant)
void
setUserData(long leastSignificant, long mostSignificant)
-
Methods inherited from class com.tigerbeetle.Batch
add, at, beforeFirst, getArray, getCapacity, getLength, getPosition, getUInt128, getUInt128, getUInt16, getUInt32, getUInt64, isReadOnly, isValidPosition, next, putArray, putUInt128, putUInt128, putUInt16, putUInt32, putUInt64, setPosition
-
-
-
-
Constructor Detail
-
TransferBatch
public TransferBatch(int capacity)
Creates an empty batch with the desired maximum capacity.Once created, an instance cannot be resized, however it may contain any number of elements between zero and its
capacity
.- Parameters:
capacity
- the maximum capacity.- Throws:
IllegalArgumentException
- if capacity is negative.
-
-
Method Detail
-
getId
public byte[] getId()
- Returns:
- an array of 16 bytes representing the 128-bit value.
- Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- id
-
getId
public long getId(UInt128 part)
- Parameters:
part
- aUInt128
enum indicating which part of the 128-bit value is to be retrieved.- Returns:
- a
long
representing the first 8 bytes of the 128-bit value ifUInt128.LeastSignificant
is informed, or the last 8 bytes ifUInt128.MostSignificant
. - Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- id
-
setId
public void setId(byte[] id)
- Parameters:
id
- an array of 16 bytes representing the 128-bit value.- Throws:
IllegalArgumentException
- ifid
is not 16 bytes long.IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- id
-
setId
public void setId(long leastSignificant, long mostSignificant)
- Parameters:
leastSignificant
- along
representing the first 8 bytes of the 128-bit value.mostSignificant
- along
representing the last 8 bytes of the 128-bit value.- Throws:
IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- id
-
setId
public void setId(long leastSignificant)
- Parameters:
leastSignificant
- along
representing the first 8 bytes of the 128-bit value.- Throws:
IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- id
-
getDebitAccountId
public byte[] getDebitAccountId()
- Returns:
- an array of 16 bytes representing the 128-bit value.
- Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- debit_account_id
-
getDebitAccountId
public long getDebitAccountId(UInt128 part)
- Parameters:
part
- aUInt128
enum indicating which part of the 128-bit value is to be retrieved.- Returns:
- a
long
representing the first 8 bytes of the 128-bit value ifUInt128.LeastSignificant
is informed, or the last 8 bytes ifUInt128.MostSignificant
. - Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- debit_account_id
-
setDebitAccountId
public void setDebitAccountId(byte[] debitAccountId)
- Parameters:
debitAccountId
- an array of 16 bytes representing the 128-bit value.- Throws:
IllegalArgumentException
- ifdebitAccountId
is not 16 bytes long.IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- debit_account_id
-
setDebitAccountId
public void setDebitAccountId(long leastSignificant, long mostSignificant)
- Parameters:
leastSignificant
- along
representing the first 8 bytes of the 128-bit value.mostSignificant
- along
representing the last 8 bytes of the 128-bit value.- Throws:
IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- debit_account_id
-
setDebitAccountId
public void setDebitAccountId(long leastSignificant)
- Parameters:
leastSignificant
- along
representing the first 8 bytes of the 128-bit value.- Throws:
IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- debit_account_id
-
getCreditAccountId
public byte[] getCreditAccountId()
- Returns:
- an array of 16 bytes representing the 128-bit value.
- Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- credit_account_id
-
getCreditAccountId
public long getCreditAccountId(UInt128 part)
- Parameters:
part
- aUInt128
enum indicating which part of the 128-bit value is to be retrieved.- Returns:
- a
long
representing the first 8 bytes of the 128-bit value ifUInt128.LeastSignificant
is informed, or the last 8 bytes ifUInt128.MostSignificant
. - Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- credit_account_id
-
setCreditAccountId
public void setCreditAccountId(byte[] creditAccountId)
- Parameters:
creditAccountId
- an array of 16 bytes representing the 128-bit value.- Throws:
IllegalArgumentException
- ifcreditAccountId
is not 16 bytes long.IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- credit_account_id
-
setCreditAccountId
public void setCreditAccountId(long leastSignificant, long mostSignificant)
- Parameters:
leastSignificant
- along
representing the first 8 bytes of the 128-bit value.mostSignificant
- along
representing the last 8 bytes of the 128-bit value.- Throws:
IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- credit_account_id
-
setCreditAccountId
public void setCreditAccountId(long leastSignificant)
- Parameters:
leastSignificant
- along
representing the first 8 bytes of the 128-bit value.- Throws:
IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- credit_account_id
-
getUserData
public byte[] getUserData()
- Returns:
- an array of 16 bytes representing the 128-bit value.
- Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- user_data
-
getUserData
public long getUserData(UInt128 part)
- Parameters:
part
- aUInt128
enum indicating which part of the 128-bit value is to be retrieved.- Returns:
- a
long
representing the first 8 bytes of the 128-bit value ifUInt128.LeastSignificant
is informed, or the last 8 bytes ifUInt128.MostSignificant
. - Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- user_data
-
setUserData
public void setUserData(byte[] userData)
- Parameters:
userData
- an array of 16 bytes representing the 128-bit value.- Throws:
IllegalArgumentException
- ifuserData
is not 16 bytes long.IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- user_data
-
setUserData
public void setUserData(long leastSignificant, long mostSignificant)
- Parameters:
leastSignificant
- along
representing the first 8 bytes of the 128-bit value.mostSignificant
- along
representing the last 8 bytes of the 128-bit value.- Throws:
IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- user_data
-
setUserData
public void setUserData(long leastSignificant)
- Parameters:
leastSignificant
- along
representing the first 8 bytes of the 128-bit value.- Throws:
IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- user_data
-
getPendingId
public byte[] getPendingId()
- Returns:
- an array of 16 bytes representing the 128-bit value.
- Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- pending_id
-
getPendingId
public long getPendingId(UInt128 part)
- Parameters:
part
- aUInt128
enum indicating which part of the 128-bit value is to be retrieved.- Returns:
- a
long
representing the first 8 bytes of the 128-bit value ifUInt128.LeastSignificant
is informed, or the last 8 bytes ifUInt128.MostSignificant
. - Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- pending_id
-
setPendingId
public void setPendingId(byte[] pendingId)
- Parameters:
pendingId
- an array of 16 bytes representing the 128-bit value.- Throws:
IllegalArgumentException
- ifpendingId
is not 16 bytes long.IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- pending_id
-
setPendingId
public void setPendingId(long leastSignificant, long mostSignificant)
- Parameters:
leastSignificant
- along
representing the first 8 bytes of the 128-bit value.mostSignificant
- along
representing the last 8 bytes of the 128-bit value.- Throws:
IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- pending_id
-
setPendingId
public void setPendingId(long leastSignificant)
- Parameters:
leastSignificant
- along
representing the first 8 bytes of the 128-bit value.- Throws:
IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- pending_id
-
getTimeout
public long getTimeout()
- Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- timeout
-
setTimeout
public void setTimeout(long timeout)
- Parameters:
timeout
-- Throws:
IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- timeout
-
getLedger
public int getLedger()
- Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- ledger
-
setLedger
public void setLedger(int ledger)
- Parameters:
ledger
-- Throws:
IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- ledger
-
getCode
public int getCode()
- Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- code
-
setCode
public void setCode(int code)
- Parameters:
code
-- Throws:
IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- code
-
getFlags
public int getFlags()
- Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- flags
-
setFlags
public void setFlags(int flags)
- Parameters:
flags
-- Throws:
IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- flags
-
getAmount
public long getAmount()
- Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- amount
-
setAmount
public void setAmount(long amount)
- Parameters:
amount
-- Throws:
IllegalStateException
- if not at avalid position
.IllegalStateException
- if aread-only
batch.- See Also:
- amount
-
getTimestamp
public long getTimestamp()
- Throws:
IllegalStateException
- if not at avalid position
.- See Also:
- timestamp
-
-