public class Compound
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
TYPE |
|
static int |
VERSION |
Constructor | Description |
---|---|
Compound() |
Create a compound contract, nested contracts can be added to
There are two possible usages of compound contract technique.
|
Compound(byte[] packedTransaction) |
Create Compound from packed transaction of compound contract
|
Compound(Contract compoundContract) |
Create Compound from compound contract
|
Modifier and Type | Method | Description |
---|---|---|
void |
addContract(java.lang.String tag,
Contract contractToPutInto,
net.sergeych.tools.Binder dataToAssociateWith) |
Add contract to Compound.
|
Contract |
getCompoundContract() |
Get contract that holds tags,contracts and data associated.
|
Contract |
getContract(HashId contractId) |
Get contract from Compound by id
|
Contract |
getContract(java.lang.String tag) |
Get contract from Compound by tag
|
net.sergeych.tools.Binder |
getData(java.lang.String tag) |
Get contract associated data from Compound by tag
|
static Compound |
getHoldingCompound(HashId contractInPack,
TransactionPack transactionPack) |
Returns compound that holds a contract with given ID (if exists)
|
java.util.Set<java.lang.String> |
getTags() |
Get tags from Compound
|
public static final java.lang.String TYPE
public static final int VERSION
public Compound(Contract compoundContract)
compoundContract
- unpacked compound contractpublic Compound(byte[] packedTransaction) throws java.io.IOException
packedTransaction
- java.io.IOException
public Compound()
public static Compound getHoldingCompound(HashId contractInPack, TransactionPack transactionPack)
contractInPack
- id of a contract held by compoundtransactionPack
- transaction pack to look intonull
otherwisepublic void addContract(java.lang.String tag, Contract contractToPutInto, net.sergeych.tools.Binder dataToAssociateWith)
getContract(String)
has reconstructed transaction pack
with referenced items includetag
- string associated with contract being addedcontractToPutInto
- contract being addeddataToAssociateWith
- binder associated with contract being addedpublic Contract getContract(HashId contractId)
contractId
- id of a contract in compoundpublic Contract getContract(java.lang.String tag)
tag
- string to find contract bypublic net.sergeych.tools.Binder getData(java.lang.String tag)
tag
- string to find data bypublic java.util.Set<java.lang.String> getTags()
public Contract getCompoundContract()