Skip to content

Commit

Permalink
Add additional JavaDoc (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
neutralleiter committed Jan 2, 2018
1 parent b2141bf commit a938d93
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import eu.bittrade.libs.steemj.plugins.apis.account.history.models.GetAccountHistoryReturn;
import eu.bittrade.libs.steemj.plugins.apis.account.history.models.GetOpsInBlockArgs;
import eu.bittrade.libs.steemj.plugins.apis.account.history.models.GetOpsInBlockReturn;
import eu.bittrade.libs.steemj.plugins.apis.account.history.models.GetTransactionArgs;
import eu.bittrade.libs.steemj.plugins.apis.account.history.models.GetAccountHistoryArgsTest;
import eu.bittrade.libs.steemj.protocol.AnnotatedSignedTransaction;

/**
Expand Down Expand Up @@ -92,7 +92,7 @@ public static GetOpsInBlockReturn getOpsInBlock(CommunicationHandler communicati
* </ul>
*/
public static AnnotatedSignedTransaction getTransaction(CommunicationHandler communicationHandler,
GetTransactionArgs getTransactionArgs) throws SteemCommunicationException, SteemResponseException {
GetAccountHistoryArgsTest getTransactionArgs) throws SteemCommunicationException, SteemResponseException {
JsonRPCRequest requestObject = new JsonRPCRequest();
requestObject.setApiMethod(RequestMethods.GET_TRANSACTION);
requestObject.setSteemApi(SteemApiType.ACCOUNT_HISTORY_API);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

import eu.bittrade.libs.steemj.communication.CommunicationHandler;
import eu.bittrade.libs.steemj.plugins.apis.account.history.AccountHistoryApi;
import eu.bittrade.libs.steemj.protocol.AccountName;
import eu.bittrade.libs.steemj.util.SteemJUtils;
Expand All @@ -28,47 +29,61 @@ public class GetAccountHistoryArgs {

/**
* Create a new {@link GetAccountHistoryArgs} instance to be passed to the
* {@link AccountHistoryApi#getAccountHistory(eu.bittrade.libs.steemj.communication.CommunicationHandler, GetAccountHistoryArgs)}
* {@link AccountHistoryApi#getAccountHistory(CommunicationHandler, GetAccountHistoryArgs)}
* method.
*
* Define how many operations (see {@link #setLimit(UInteger)} and
* {@link #setStart(ULong)}) for which <code>account</code> are requested.
*
* @param account
* The account name to request the history for.
* @param start
* The id of the first operation to return. If not provided,
* <code>-1</code> will be used as a default value.
* @param limit
* The number of results to return. If not provided,
* <code>1000</code> will be used as a default value.
*/
@JsonCreator()
public GetAccountHistoryArgs(@JsonProperty("account") AccountName account, @JsonProperty("start") ULong start,
@JsonProperty("limit") UInteger limit) {
public GetAccountHistoryArgs(@JsonProperty("account") AccountName account,
@Nullable @JsonProperty("start") ULong start, @Nullable @JsonProperty("limit") UInteger limit) {
this.setAccount(account);
this.setStart(start);
this.setLimit(limit);
}

/**
* @return the account
* @return The currently configured <code>account</code> to request the
* history for.
*/
public AccountName getAccount() {
return account;
}

/**
* Override the currently configured <code>account</code> to request the
* history for.
*
* @param account
* the account to set
* The <code>account</code> to request the history for.
*/
public void setAccount(AccountName account) {
this.account = SteemJUtils.setIfNotNull(account, "The account is required.");
}

/**
* @return the start
* @return The currently configured <code>start</code> parameter.
*/
public ULong getStart() {
return start;
}

/**
* Override the currently configured <code>start</code> parameter. The
* <code>start</code> parameter defines the first operation returned.
*
* @param start
* the start to set
* The <code>start</code> parameter to set.
*/
public void setStart(ULong start) {
// If not provided set the start to its default value.
Expand All @@ -83,8 +98,12 @@ public UInteger getLimit() {
}

/**
* Override the currently configured <code>limit</code> parameter. The
* <code>limit</code> parameter defines how many operations made by the
* {@link #getAccount() Account} are requested.
*
* @param limit
* the limit to set
* The <code>limit</code> parameter to set.
*/
public void setLimit(@Nullable UInteger limit) {
// If not provided set the limit to its default value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ private GetAccountHistoryReturn() {
}

/**
* @return the history
* Get the requested history for the requested account. The history is
* represented by a list of all operations ever made by an account. The map
* <code>key</code> represents the <code>id</code> of the operation and the
* map <code>value</code> is the operation itself.
*
* @return A map of operations and their id.
*/
public Map<UInteger, AppliedOperation> getHistory() {
return history;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ public class GetOpsInBlockArgs {
* method.
*
* @param blockNum
* The <code>blockNum</code> defines for which block number
* operations are requested.
* @param onlyVirtual
* Define if only virtual (<code>true</code>) or all operation
* types (<code>false</code>) are requested.
*/
@JsonCreator()
public GetOpsInBlockArgs(@JsonProperty("block_num") UInteger blockNum,
Expand All @@ -38,33 +42,47 @@ public GetOpsInBlockArgs(@JsonProperty("block_num") UInteger blockNum,
}

/**
* @return the blockNum
* @return The block number wrapped by this instance.
*/
public UInteger getBlockNum() {
return blockNum;
}

/**
* Override the current <code>blockNum</code> field wrapped by this
* instance.
*
* The <code>blockNum</code> defines for which block number operations are
* requested.
*
* @param blockNum
* the blockNum to set
* The block number to set.
*/
public void setBlockNum(UInteger blockNum) {
this.blockNum = SteemJUtils.setIfNotNull(blockNum, "The block number cannot be null.");
}

/**
* @return the onlyVirtual
* Check if only virtual operations (<code>true</code>) or all operation
* types (<code>false</code>) are requested .
*
* @return <code>true</code>, if only virtual operations are requested or
* <code>false</code> if not.
*/
public boolean getOnlyVirtual() {
return onlyVirtual;
}

/**
* Override the current <code>onlyVirtual</code> field wrapped by this
* instance.
*
* @param onlyVirtual
* the onlyVirtual to set
* Define if only virtual (<code>true</code>) or all operation
* types (<code>false</code>) are requested.
*/
public void setOnlyVirtual(boolean onlyVirtual) {
this.onlyVirtual = onlyVirtual;
this.onlyVirtual = onlyVirtual;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@

import com.fasterxml.jackson.annotation.JsonProperty;

import eu.bittrade.libs.steemj.protocol.operations.Operation;

/**
* This class implements the Steem "get_ops_in_block_return" object.
*
* @author <a href="http://steemit.com/@dez1337">dez1337</a>
*/
public class GetOpsInBlockReturn {
@JsonProperty("ops")
private List<Operation> operations;
private List<AppliedOperation> operations;

/**
* This object is only used to wrap the JSON response in a POJO, so
Expand All @@ -25,9 +23,12 @@ private GetOpsInBlockReturn() {
}

/**
* @return the operations
* Get the list of {@link AppliedOperation AppliedOperations} returned from
* the Steem Node.
*
* @return A list of {@link AppliedOperation AppliedOperations}.
*/
public List<Operation> getOperations() {
public List<AppliedOperation> getOperations() {
return operations;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package eu.bittrade.libs.steemj.plugins.apis.account.history.models;

import java.security.InvalidParameterException;

import org.apache.commons.lang3.builder.ToStringBuilder;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

import eu.bittrade.libs.steemj.communication.CommunicationHandler;
import eu.bittrade.libs.steemj.plugins.apis.account.history.AccountHistoryApi;
import eu.bittrade.libs.steemj.protocol.TransactionId;
import eu.bittrade.libs.steemj.util.SteemJUtils;
Expand All @@ -20,26 +23,33 @@ public class GetTransactionArgs {

/**
* Create a new {@link GetAccountHistoryArgs} instance to be passed to the
* {@link AccountHistoryApi#getAccountHistory(eu.bittrade.libs.steemj.communication.CommunicationHandler, GetAccountHistoryArgs)}
* {@link AccountHistoryApi#getAccountHistory(CommunicationHandler, GetAccountHistoryArgs)}
* method.
*
* @param id
* The {@link TransactionId} to set.
*/
@JsonCreator()
public GetTransactionArgs(@JsonProperty("id") TransactionId id) {
this.setId(id);
}

/**
* @return the id
* @return The {@link TransactionId} wrapped by this instance.
*/
public TransactionId getId() {
return id;
}

/**
* Override the current {@link TransactionId} wrapped by this instance.
* Please notice that the <code>id</code> is required. If not provided, the
* method will throw an {@link InvalidParameterException}.
*
* @param id
* the id to set
* The {@link TransactionId} to set.
* @throws InvalidParameterException
* If the <code>id</code> is null.
*/
public void setId(TransactionId id) {
this.id = SteemJUtils.setIfNotNull(id, "The id cannot be null.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import eu.bittrade.libs.steemj.plugins.apis.account.history.models.AppliedOperation;
import eu.bittrade.libs.steemj.plugins.apis.account.history.models.GetAccountHistoryArgs;
import eu.bittrade.libs.steemj.plugins.apis.account.history.models.GetOpsInBlockArgs;
import eu.bittrade.libs.steemj.plugins.apis.account.history.models.GetTransactionArgs;
import eu.bittrade.libs.steemj.plugins.apis.account.history.models.GetAccountHistoryArgsTest;
import eu.bittrade.libs.steemj.plugins.apis.block.BlockApi;
import eu.bittrade.libs.steemj.plugins.apis.block.models.ExtendedSignedBlock;
import eu.bittrade.libs.steemj.plugins.apis.block.models.GetBlockArgs;
Expand Down Expand Up @@ -96,7 +96,7 @@ public void testGetOpsInBlock() throws SteemCommunicationException, SteemRespons
public void testGetTransaction() throws SteemCommunicationException, SteemResponseException {
// TODO: Check also null case of optional
final AnnotatedSignedTransaction annotatedSignedTransaction = AccountHistoryApi
.getTransaction(COMMUNICATION_HANDLER, new GetTransactionArgs(new TransactionId("bd8069e6544f658da560b72e93b605dfe2cb0aaf")));
.getTransaction(COMMUNICATION_HANDLER, new GetAccountHistoryArgsTest(new TransactionId("bd8069e6544f658da560b72e93b605dfe2cb0aaf")));

//assertThat(annotatedSignedTransaction.getTimestamp().getDateTime(), equalTo("2017-07-02T19:15:06"));
//assertThat(blockHeader.getWitness(), equalTo(new AccountName("clayop")));
Expand Down

0 comments on commit a938d93

Please sign in to comment.