Skip to content

Commit

Permalink
Verify that required fields are set (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
neutralleiter committed Jan 2, 2018
1 parent 9084c26 commit b2141bf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import eu.bittrade.libs.steemj.communication.CommunicationHandler;
import eu.bittrade.libs.steemj.plugins.apis.witness.WitnessApi;
import eu.bittrade.libs.steemj.plugins.apis.witness.models.GetAccountBandwidthArgs;
import eu.bittrade.libs.steemj.util.SteemJUtils;

/**
* This class implements the Steem "get_ops_in_block_args" object.
Expand All @@ -19,18 +20,19 @@ public class GetOpsInBlockArgs {
@JsonProperty("block_num")
private UInteger blockNum;
@JsonProperty("onlyVirtual")
private Boolean onlyVirtual;
private boolean onlyVirtual;

/**
* Create a new {@link GetAccountBandwidthArgs} instance to be passed to the
* {@link WitnessApi#getAccountBandwidth(CommunicationHandler, GetAccountBandwidthArgs)}
* method.
* @param blockNum
* @param onlyVirtual
*
* @param blockNum
* @param onlyVirtual
*/
@JsonCreator()
public GetOpsInBlockArgs(@JsonProperty("block_num") UInteger blockNum,
@JsonProperty("onlyVirtual") Boolean onlyVirtual) {
@JsonProperty("onlyVirtual") boolean onlyVirtual) {
this.setBlockNum(blockNum);
this.setOnlyVirtual(onlyVirtual);
}
Expand All @@ -47,22 +49,22 @@ public UInteger getBlockNum() {
* the blockNum to set
*/
public void setBlockNum(UInteger blockNum) {
this.blockNum = blockNum;
this.blockNum = SteemJUtils.setIfNotNull(blockNum, "The block number cannot be null.");
}

/**
* @return the onlyVirtual
*/
public Boolean getOnlyVirtual() {
public boolean getOnlyVirtual() {
return onlyVirtual;
}

/**
* @param onlyVirtual
* the onlyVirtual to set
*/
public void setOnlyVirtual(Boolean onlyVirtual) {
this.onlyVirtual = onlyVirtual;
public void setOnlyVirtual(boolean onlyVirtual) {
this.onlyVirtual = onlyVirtual;
}

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

import eu.bittrade.libs.steemj.plugins.apis.account.history.AccountHistoryApi;
import eu.bittrade.libs.steemj.protocol.TransactionId;
import eu.bittrade.libs.steemj.util.SteemJUtils;

/**
* This class implements the Steem "get_transaction_args" object.
Expand Down Expand Up @@ -41,7 +42,7 @@ public TransactionId getId() {
* the id to set
*/
public void setId(TransactionId id) {
this.id = id;
this.id = SteemJUtils.setIfNotNull(id, "The id cannot be null.");
}

@Override
Expand Down

0 comments on commit b2141bf

Please sign in to comment.