documentation

This commit is contained in:
pinpong 2017-02-14 20:58:35 +01:00
parent 02024f0f5c
commit 8cb20c2792
31 changed files with 439 additions and 1 deletions

View File

@ -13,6 +13,9 @@ public class IotaAttachToTangleRequest extends IotaCommandRequest {
private Integer minWeightMagnitude;
private String[] trytes;
/**
* Initializes a new instance of the IotaAttachedToTangleRequest class.
*/
private IotaAttachToTangleRequest(final String trunkTransaction, final String branchTransaction, final Integer minWeightMagnitude, final String... trytes) {
super(IotaAPICommands.ATTACH_TO_TANGLE);
this.trunkTransaction = trunkTransaction;
@ -21,38 +24,75 @@ public class IotaAttachToTangleRequest extends IotaCommandRequest {
this.trytes = trytes;
}
/**
* Create a new instance of the IotaAttachedToTangleRequest class.
*/
public static IotaAttachToTangleRequest createAttachToTangleRequest(final String trunkTransaction, final String branchTransaction, final Integer minWeightMagnitude, final String... trytes) {
return new IotaAttachToTangleRequest(trunkTransaction, branchTransaction, minWeightMagnitude, trytes);
}
/**
* Gets the trunk transaction.
*
* @return trunkTransaction The trunk transaction.
*/
public String getTrunkTransaction() {
return trunkTransaction;
}
/**
* Sets the trunk transaction.
*
* @param trunkTransaction The trunk transaction.
*/
public void setTrunkTransaction(String trunkTransaction) {
this.trunkTransaction = trunkTransaction;
}
/**
* Gets the brancht ransaction.
* @return branchTransaction The branch transaction.
*/
public String getBranchTransaction() {
return branchTransaction;
}
/**
* Sets the branch transaction.
* @param branchTransaction the branch transaction.
*/
public void setBranchTransaction(String branchTransaction) {
this.branchTransaction = branchTransaction;
}
/**
* Gets the min weight magnitude.
* @return minWeightMagnitude The min weight magnitude.
*/
public Integer getMinWeightMagnitude() {
return minWeightMagnitude;
}
/**
* Sets the min weight magnitude.
* @param minWeightMagnitude The min weight magnitude.
*/
public void setMinWeightMagnitude(Integer minWeightMagnitude) {
this.minWeightMagnitude = minWeightMagnitude;
}
/**
* Gets the trytes.
* @return trytes The trytes.
*/
public String[] getTrytes() {
return trytes;
}
/**
* Sets the trytes.
* @param trytes The trytes.
*/
public void setTrytes(String[] trytes) {
this.trytes = trytes;
}

View File

@ -9,19 +9,35 @@ public class IotaBroadcastTransactionRequest extends IotaCommandRequest {
private String[] trytes;
/**
* Initializes a new instance of the IotaBroadcastTransactionRequest class.
*/
private IotaBroadcastTransactionRequest(final String... trytes) {
super(IotaAPICommands.BROADCAST_TRANSACTIONS);
this.trytes = trytes;
}
/**
* Initializes a new instance of the IotaBroadcastTransactionRequest class.
*/
public static IotaBroadcastTransactionRequest createBroadcastTransactionsRequest(final String... trytes) {
return new IotaBroadcastTransactionRequest(trytes);
}
/**
* Gets the trytes.
*
* @return trytes The trytes.
*/
public String[] getTrytes() {
return trytes;
}
/**
* Sets the trytes.
*
* @param trytes The trytes.
*/
public void setTrytes(String[] trytes) {
this.trytes = trytes;
}

View File

@ -12,42 +12,82 @@ public class IotaFindTransactionsRequest extends IotaCommandRequest {
private String[] tags;
private String[] approvees;
/**
* Initializes a new instance of the IotaFindTransactionsRequest class.
*/
private IotaFindTransactionsRequest() {
super(IotaAPICommands.FIND_TRANSACTIONS);
}
/**
* Create a new instance of the IotaFindTransactionsRequest class.
*/
public static IotaFindTransactionsRequest createFindTransactionRequest() {
return new IotaFindTransactionsRequest();
}
/**
* Gets the bundles.
*
* @return bundles The bundles.
*/
public String[] getBundles() {
return bundles;
}
/**
* Sets the bundles.
*
* @param bundles The bundles.
*/
public void setBundles(String[] bundles) {
this.bundles = bundles;
}
/**
* Gets the addresses.
* @return addresses The addresses.
*/
public String[] getAddresses() {
return addresses;
}
/**
* Sets the addresses.
* @param addresses The addresses.
*/
public void setAddresses(String[] addresses) {
this.addresses = addresses;
}
/**
* Gets the tags.
* @return tags The tags.
*/
public String[] getTags() {
return tags;
}
/**
* Sets the tags.
* @param tags The tags.
*/
public void setTags(String[] tags) {
this.tags = tags;
}
/**
* Gets the approvees.
* @return approvees The approvees.
*/
public String[] getApprovees() {
return approvees;
}
/**
* Sets the approvees.
* @param approvees The approvees.
*/
public void setApprovees(String[] approvees) {
this.approvees = approvees;
}

View File

@ -10,28 +10,52 @@ public class IotaGetBalancesRequest extends IotaCommandRequest {
private String[] addresses;
private Integer threshold;
/**
* Initializes a new instance of the IotaGetBalancesRequest class.
*/
private IotaGetBalancesRequest(final Integer threshold, final String... addresses) {
super(IotaAPICommands.GET_BALANCES);
this.addresses = addresses;
this.threshold = threshold;
}
/**
* Create a new instance of the IotaGetBalancesRequest class.
*/
public static IotaGetBalancesRequest createIotaGetBalancesRequest(final Integer threshold, final String... addresses) {
return new IotaGetBalancesRequest(threshold, addresses);
}
/**
* Gets the addresses.
*
* @return addresses The addresses.
*/
public String[] getAddresses() {
return addresses;
}
/**
* Sets the addresses.
*
* @param addresses The addresses.
*/
public void setAddresses(String[] addresses) {
this.addresses = addresses;
}
/**
* Gets the threshold.
* @return threshold The threshold.
*/
public Integer getThreshold() {
return threshold;
}
/**
* Sets the threshold.
* @param threshold The threshold.
*/
public void setThreshold(Integer threshold) {
this.threshold = threshold;
}

View File

@ -12,34 +12,61 @@ public class IotaGetInclusionStateRequest extends IotaCommandRequest {
private String[] transactions;
private String[] tips;
/**
* Initializes a new instance of the IotaGetInclusionStateRequest class.
*/
private IotaGetInclusionStateRequest(final String[] transactions, final String[] tips) {
super(IotaAPICommands.GET_INCLUSIONS_STATES);
this.transactions = transactions;
this.tips = tips;
}
/**
* Create a new instance of the IotaGetInclusionStateRequest class.
*/
public static IotaGetInclusionStateRequest createGetInclusionStateRequest(String[] transactions, String[] tips) {
return new IotaGetInclusionStateRequest(transactions, tips);
}
/**
* Create a new instance of the IotaGetInclusionStateRequest class.
*/
public static IotaGetInclusionStateRequest createGetInclusionStateRequest(Collection<String> transactions, Collection<String> tips) {
return createGetInclusionStateRequest(
transactions.toArray(new String[]{}),
tips.toArray(new String[]{}));
}
/**
* Gets the transactions.
*
* @return transactions The transactions.
*/
public String[] getTransactions() {
return transactions;
}
/**
* Sets the transactions.
*
* @param transactions The transactions.
*/
public void setTransactions(String[] transactions) {
this.transactions = transactions;
}
/**
* Gets the tips.
* @return tips The tips.
*/
public String[] getTips() {
return tips;
}
/**
* Sets the tips.
* @param tips The tips.
*/
public void setTips(String[] tips) {
this.tips = tips;
}

View File

@ -9,19 +9,35 @@ public class IotaGetTransactionsToApproveRequest extends IotaCommandRequest {
private Integer depth;
/**
* Initializes a new instance of the IotaGetTransactionsToApproveRequest class.
*/
private IotaGetTransactionsToApproveRequest(final Integer depth) {
super(IotaAPICommands.GET_TRANSACTIONS_TO_APPROVE);
this.depth = depth;
}
/**
* Create a new instance of the IotaGetTransactionsToApproveRequest class.
*/
public static IotaGetTransactionsToApproveRequest createIotaGetTransactionsToApproveRequest(Integer depth) {
return new IotaGetTransactionsToApproveRequest(depth);
}
/**
* Gets the depth.
*
* @return depth The depth.
*/
public Integer getDepth() {
return depth;
}
/**
* Sets the depth.
*
* @param depth The depth.
*/
public void setDepth(Integer depth) {
this.depth = depth;
}

View File

@ -9,19 +9,35 @@ public class IotaGetTrytesRequest extends IotaCommandRequest {
private String[] hashes;
/**
* Initializes a new instance of the IotaGetTrytesRequest class.
*/
private IotaGetTrytesRequest(final String... hashes) {
super(IotaAPICommands.GET_TRYTES);
this.hashes = hashes;
}
/**
* Create a new instance of the IotaGetTrytesRequest class.
*/
public static IotaGetTrytesRequest createGetTrytesRequest(String... hashes) {
return new IotaGetTrytesRequest(hashes);
}
/**
* Gets the hashes.
*
* @return hashes The hashes.
*/
public String[] getHashes() {
return hashes;
}
/**
* Sets the hashes.
*
* @param hashes The hashes.
*/
public void setHashes(String[] hashes) {
this.hashes = hashes;
}

View File

@ -9,23 +9,42 @@ public class IotaNeighborsRequest extends IotaCommandRequest {
private String[] uris;
/**
* Initializes a new instance of the IotaNeighborsRequest class.
*/
private IotaNeighborsRequest(IotaAPICommands type, final String... uris) {
super(type);
this.uris = uris;
}
/**
* Create a new instance of the IotaNeighborsRequest class.
*/
public static IotaNeighborsRequest createAddNeighborsRequest(String... uris) {
return new IotaNeighborsRequest(IotaAPICommands.ADD_NEIGHBORS, uris);
}
/**
* Create a new instance of the IotaNeighborsRequest class.
*/
public static IotaNeighborsRequest createRemoveNeighborsRequest(String... uris) {
return new IotaNeighborsRequest(IotaAPICommands.REMOVE_NEIGHBORS, uris);
}
/**
* Gets the uris.
*
* @return uris The uris.
*/
public String[] getUris() {
return uris;
}
/**
* Sets the uris.
*
* @param uris The uris.
*/
public void setUris(String[] uris) {
this.uris = uris;
}

View File

@ -10,19 +10,35 @@ public class IotaStoreTransactionsRequest extends IotaCommandRequest {
private String[] trytes;
/**
* Initializes a new instance of the IotaStoreTransactionsRequest class.
*/
private IotaStoreTransactionsRequest(final String... trytes) {
super(IotaAPICommands.STORE_TRANSACTIONS);
this.trytes = trytes;
}
/**
* Create a new instance of the IotaStoreTransactionsRequest class.
*/
public static IotaStoreTransactionsRequest createStoreTransactionsRequest(final String... trytes) {
return new IotaStoreTransactionsRequest(trytes);
}
/**
* Gets the trytes.
*
* @return trytes The trytes.
*/
public String[] getTrytes() {
return trytes;
}
/**
* Sets the trytes.
*
* @param trytes The trytes.
*/
public void setTrytes(String[] trytes) {
this.trytes = trytes;
}

View File

@ -7,6 +7,11 @@ public class AddNeighborsResponse extends AbstractResponse {
private int addedNeighbors;
/**
* Gets the number of added neighbors.
*
* @return addedNeighbors The number of added neighbors.
*/
public int getAddedNeighbors() {
return addedNeighbors;
}

View File

@ -12,6 +12,11 @@ public class AnalyzeTransactionResponse extends AbstractResponse {
private List<Transaction> transactions = new ArrayList<>();
/**
* Gets the transactions.
*
* @return transactions trytes The transactions.
*/
public List<Transaction> getTransactions() {
return transactions;
}

View File

@ -7,6 +7,12 @@ public class FindTransactionResponse extends AbstractResponse {
String[] hashes;
/**
* Gets the hashes.
*
* @return hashes trytes The hashes.
*/
public String[] getHashes() {
return hashes;
}

View File

@ -7,10 +7,18 @@ public class GetAttachToTangleResponse extends AbstractResponse {
private String[] trytes;
/**
* Initializes a new instance of the GetAttachToTangleResponse class.
*/
public GetAttachToTangleResponse(long duration) {
setDuration(duration);
}
/**
* Gets the rytes.
*
* @return trytes The trytes.
*/
public String[] getTrytes() {
return trytes;
}

View File

@ -12,6 +12,9 @@ public class GetBalancesAndFormatResponse extends AbstractResponse {
private List<Input> input;
private long totalBalance;
/**
* Initializes a new instance of the GetBalancesAndFormatResponse class.
*/
public static GetBalancesAndFormatResponse create(List<Input> inputs, long totalBalance2, long duration) {
GetBalancesAndFormatResponse res = new GetBalancesAndFormatResponse();
res.setInput(inputs);
@ -20,18 +23,36 @@ public class GetBalancesAndFormatResponse extends AbstractResponse {
return res;
}
/**
* Gets the input.
*
* @return transactions The transactions.
*/
public List<Input> getInput() {
return input;
}
/**
* Sets the input.
*
* @param input The input.
*/
public void setInput(List<Input> input) {
this.input = input;
}
/**
* Gets the total balance.
* @return totalBalance The total balance.
*/
public long getTotalBalance() {
return totalBalance;
}
/**
* Sets the total balance.
* @param totalBalance The total balance.
*/
public void setTotalBalance(long totalBalance) {
this.totalBalance = totalBalance;
}

View File

@ -9,14 +9,28 @@ public class GetBalancesResponse extends AbstractResponse {
private String milestone;
private int milestoneIndex;
/**
* Gets the milestone index.
*
* @return milestoneIndex The milestone index.
*/
public int getMilestoneIndex() {
return milestoneIndex;
}
/**
* Gets the milestone.
*
* @return milestone The milestone.
*/
public String getMilestone() {
return milestone;
}
/**
* Gets the balances.
* @return balances The balances.
*/
public String[] getBalances() {
return balances;
}

View File

@ -12,6 +12,9 @@ public class GetBundleResponse extends AbstractResponse {
private List<Transaction> transactions = new ArrayList<>();
/**
* Initializes a new instance of the GetBundleResponse class.
*/
public static GetBundleResponse create(List<Transaction> transactions, long duration) {
GetBundleResponse res = new GetBundleResponse();
res.transactions = transactions;
@ -19,7 +22,11 @@ public class GetBundleResponse extends AbstractResponse {
return res;
}
/**
* Gets the transactions.
*
* @return transactions The transactions.
*/
public List<Transaction> getTransactions() {
return transactions;
}

View File

@ -7,6 +7,11 @@ public class GetInclusionStateResponse extends AbstractResponse {
boolean[] states;
/**
* Gets the states.
*
* @return states The states.
*/
public boolean[] getStates() {
return states;
}

View File

@ -12,6 +12,11 @@ public class GetNeighborsResponse extends AbstractResponse {
private List<Neighbor> neighbors = new ArrayList<>();
/**
* Gets the neighbors.
*
* @return neighbors The neighbors.
*/
public List<Neighbor> getNeighbors() {
return neighbors;
}

View File

@ -9,6 +9,9 @@ public class GetNewAddressResponse extends AbstractResponse {
private List<String> addresses;
/**
* Initializes a new instance of the GetNewAddressResponse class.
*/
public static GetNewAddressResponse create(List<String> addresses, long duration) {
GetNewAddressResponse res = new GetNewAddressResponse();
res.addresses = addresses;
@ -16,6 +19,11 @@ public class GetNewAddressResponse extends AbstractResponse {
return res;
}
/**
* Gets the addresses.
*
* @return addresses The addresses.
*/
public List<String> getAddresses() {
return addresses;
}

View File

@ -22,66 +22,134 @@ public class GetNodeInfoResponse extends AbstractResponse {
private int tips;
private int transactionsToRequest;
/**
* Name of the IOTA software you're currently using (IRI stands for Initial Reference Implementation).
*
* @return appName
*/
public String getAppName() {
return appName;
}
/**
* The version of the IOTA software you're currently running.
*
* @return
*/
public String getAppVersion() {
return appVersion;
}
/**
* The version of running java version.
* @return
*/
public String getJreVersion() {
return jreVersion;
}
/**
* Available cores on your machine for JRE.
* @return
*/
public Integer getJreAvailableProcessors() {
return jreAvailableProcessors;
}
/**
* The amount of free memory in the Java Virtual Machine.
* @return
*/
public long getJreFreeMemory() {
return jreFreeMemory;
}
/**
* The maximum amount of memory that the Java virtual machine will attempt to use.
* @return
*/
public long getJreMaxMemory() {
return jreMaxMemory;
}
/**
* The total amount of memory in the Java virtual machine.
* @return
*/
public long getJreTotalMemory() {
return jreTotalMemory;
}
/**
* Latest milestone that was signed off by the coordinator.
* @return
*/
public String getLatestMilestone() {
return latestMilestone;
}
/**
* Index of the latest milestone.
* @return
*/
public int getLatestMilestoneIndex() {
return latestMilestoneIndex;
}
/**
* The latest milestone which is solid and is used for sending transactions.
* For a milestone to become solid your local node must basically approve the subtangle of coordinator-approved transactions,
* and have a consistent view of all referenced transactions.
* @return
*/
public String getLatestSolidSubtangleMilestone() {
return latestSolidSubtangleMilestone;
}
/**
* Index of the latest solid subtangle.
* @return
*/
public int getLatestSolidSubtangleMilestoneIndex() {
return latestSolidSubtangleMilestoneIndex;
}
/**
* Number of neighbors you are directly connected with.
* @return
*/
public int getNeighbors() {
return neighbors;
}
/**
* Packets which are currently queued up
* @return
*/
public int getPacketsQueueSize() {
return packetsQueueSize;
}
/**
* Current UNIX timestamp.
* @return
*/
public Long getTime() {
return time;
}
/**
* Number of tips in the network.
* @return
*/
public int getTips() {
return tips;
}
/**
* Transactions to request during syncing process.
* @return
*/
public int getTransactionsToRequest() {
return transactionsToRequest;
}

View File

@ -7,6 +7,11 @@ public class GetTipsResponse extends AbstractResponse {
private String[] hashes;
/**
* Gets the hashes.
*
* @return hashes The hashes.
*/
public String[] getHashes() {
return hashes;
}

View File

@ -8,10 +8,20 @@ public class GetTransactionsToApproveResponse extends AbstractResponse {
private String trunkTransaction;
private String branchTransaction;
/**
* Gets the trunk transaction.
*
* @return trunkTransaction The trunk transaction.
*/
public String getTrunkTransaction() {
return trunkTransaction;
}
/**
* Gets the branch transaction.
*
* @return branchTransaction The branch transaction.
*/
public String getBranchTransaction() {
return branchTransaction;
}

View File

@ -9,12 +9,20 @@ public class GetTransferResponse extends AbstractResponse {
private Bundle[] transferBundle;
/**
* Initializes a new instance of the GetTransferResponse class.
*/
public static GetTransferResponse create(Bundle[] transferBundle, long duration) {
GetTransferResponse res = new GetTransferResponse();
res.transferBundle = transferBundle;
return res;
}
/**
* Gets the transfer bundle.
*
* @return transferBundle The transfer bundle.
*/
public Bundle[] getTransfers() {
return transferBundle;
}

View File

@ -7,6 +7,11 @@ public class GetTrytesResponse extends AbstractResponse {
private String[] trytes;
/**
* Gets the trytes.
*
* @return trytes The trytes.
*/
public String[] getTrytes() {
return trytes;
}

View File

@ -7,6 +7,11 @@ public class RemoveNeighborsResponse extends AbstractResponse {
private int removedNeighbors;
/**
* Gets the number of removed neighbors.
*
* @return removedNeighbors The number of removed neighbors.
*/
public int getRemovedNeighbors() {
return removedNeighbors;
}

View File

@ -7,6 +7,9 @@ public class ReplayBundleResponse extends AbstractResponse {
private Boolean[] successfully;
/**
* Initializes a new instance of the ReplayBundleResponse class.
*/
public static ReplayBundleResponse create(Boolean[] successfully, long duration) {
ReplayBundleResponse res = new ReplayBundleResponse();
res.successfully = successfully;
@ -14,10 +17,20 @@ public class ReplayBundleResponse extends AbstractResponse {
return res;
}
/**
* Gets the successfully.
*
* @return successfully The successfully.
*/
public Boolean[] getSuccessfully() {
return successfully;
}
/**
* Sets the successfully.
*
* @param successfully The successfully.
*/
public void setSuccessfully(Boolean[] successfully) {
this.successfully = successfully;
}

View File

@ -7,6 +7,9 @@ public class SendTransferResponse extends AbstractResponse {
private Boolean[] successfully;
/**
* Initializes a new instance of the SendTransferResponse class.
*/
public static SendTransferResponse create(Boolean[] successfully, long duration) {
SendTransferResponse res = new SendTransferResponse();
res.successfully = successfully;
@ -14,10 +17,20 @@ public class SendTransferResponse extends AbstractResponse {
return res;
}
/**
* Gets the successfully.
*
* @return successfully The successfully.
*/
public Boolean[] getSuccessfully() {
return successfully;
}
/**
* Sets the successfully.
*
* @param successfully The successfully.
*/
public void setSuccessfully(Boolean[] successfully) {
this.successfully = successfully;
}

View File

@ -4,6 +4,10 @@ package jota.dto.response;
* Response of {@link jota.dto.request.IotaStoreTransactionsRequest}
**/
public class StoreTransactionsResponse extends AbstractResponse {
/**
* Initializes a new instance of the StoreTransactionsResponse class.
*/
public StoreTransactionsResponse(long duration) {
setDuration(duration);
}

View File

@ -5,6 +5,9 @@ package jota.error;
*/
public class ArgumentException extends BaseException {
/**
* Serial version UID
*/
private static final long serialVersionUID = -7850044681919575720L;
public ArgumentException() {

View File

@ -9,6 +9,9 @@ import java.util.Collection;
*/
public class BaseException extends Exception {
/**
* Serial version UID
*/
private static final long serialVersionUID = 5617085097507773343L;
protected Collection<String> messages;

View File

@ -5,6 +5,9 @@ package jota.error;
*/
public class NotEnoughBalanceException extends BaseException {
/**
* Serial version UID
*/
private static final long serialVersionUID = -3807270816402226476L;
public NotEnoughBalanceException() {