T
- the transaction class an instance of this factory builds.public abstract class TransactionFactory<T extends Transaction>
extends java.lang.Object
The benefits of using a factory instead of a constructor:
Transaction
without affecting the
subclasses. It's not necessary to change subclasses constructors.
Transaction
subclasses
When a new transaction type is added, a new extension of this factory should be added too.
Constructor and Description |
---|
TransactionFactory(TransactionType type,
int version,
NetworkType networkType,
Deadline deadline)
The constructor that sets the required and default attributes.
|
TransactionFactory(TransactionType type,
NetworkType networkType,
Deadline deadline)
The constructor that sets the required and default attributes.
|
Modifier and Type | Method and Description |
---|---|
abstract T |
build() |
TransactionFactory<T> |
calculateMaxFeeFromMultiplier(long feeMultiplier)
Builder method used to to re-calculate the max fee based on the configured feeMultiplier
|
TransactionFactory<T> |
deadline(Deadline deadline)
Builder method used to change the default deadline.
|
Deadline |
getDeadline() |
java.util.Optional<TransactionGroup> |
getGroup() |
java.math.BigInteger |
getMaxFee() |
NetworkType |
getNetworkType() |
protected java.util.Optional<java.lang.Long> |
getProvidedSize() |
java.util.Optional<java.lang.String> |
getSignature() |
java.util.Optional<PublicAccount> |
getSigner() |
long |
getSize() |
java.util.Optional<TransactionInfo> |
getTransactionInfo() |
TransactionType |
getType() |
java.lang.Integer |
getVersion() |
TransactionFactory<T> |
group(TransactionGroup group)
Builder method used to change the known transaction group.
|
TransactionFactory<T> |
maxFee(java.math.BigInteger maxFee)
Builder method used to change the default maxFee.
|
TransactionFactory<T> |
signature(java.lang.String signature)
Builder method used to set the signature.
|
TransactionFactory<T> |
signer(PublicAccount signer)
Builder method used to set the signer.
|
TransactionFactory<T> |
size(long size)
Builder method used to change the default size.
|
TransactionFactory<T> |
transactionInfo(TransactionInfo transactionInfo)
Builder method used to set the
TransactionInfo . |
TransactionFactory<T> |
version(java.lang.Integer version)
Builder method used to change the default version.
|
public TransactionFactory(TransactionType type, int version, NetworkType networkType, Deadline deadline)
type
- the transaction type, this field is generally defined in the sub classes.version
- the version of the transactionnetworkType
- the network type of this transaction.deadline
- The deadline of the new transaction based on the server epoch adjustment time.public TransactionFactory(TransactionType type, NetworkType networkType, Deadline deadline)
type
- the transaction type, this field is generally defined in the sub classes.networkType
- the network type of this transaction.deadline
- The deadline of the new transaction based on the server epoch adjustment time.public TransactionFactory<T> deadline(Deadline deadline)
deadline
- a new deadlinepublic TransactionFactory<T> maxFee(java.math.BigInteger maxFee)
maxFee
- a new maxFeepublic TransactionFactory<T> calculateMaxFeeFromMultiplier(long feeMultiplier)
feeMultiplier
- the fee multiplier greater than 1public TransactionFactory<T> signature(java.lang.String signature)
signature
- the signature.public TransactionFactory<T> signer(PublicAccount signer)
signer
- the signer PublicAccount
.public TransactionFactory<T> transactionInfo(TransactionInfo transactionInfo)
TransactionInfo
. This method is generally called from
the rest api mappers.transactionInfo
- the TransactionInfo
.public TransactionFactory<T> version(java.lang.Integer version)
version
- a new versionpublic TransactionFactory<T> size(long size)
size
- the known sizepublic TransactionFactory<T> group(TransactionGroup group)
group
- a new grouppublic TransactionType getType()
public NetworkType getNetworkType()
public java.lang.Integer getVersion()
public Deadline getDeadline()
public java.math.BigInteger getMaxFee()
public java.util.Optional<java.lang.String> getSignature()
public java.util.Optional<TransactionInfo> getTransactionInfo()
public java.util.Optional<PublicAccount> getSigner()
protected java.util.Optional<java.lang.Long> getProvidedSize()
public long getSize()
public java.util.Optional<TransactionGroup> getGroup()
public abstract T build()