Skip to content

Commit f2f98a3

Browse files
committed
code improvements
1 parent f37c58a commit f2f98a3

17 files changed

+742
-723
lines changed

src/main/java/com/myjeeva/digitalocean/DigitalOcean.java

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,19 +1589,19 @@ Snapshot getSnaphotInfo(String snapshotId)
15891589
Delete deleteSnapshot(String snapshotId)
15901590
throws DigitalOceanException, RequestUnsuccessfulException;
15911591

1592-
15931592
// ===========================================
15941593
// Load balancers manipulation methods
15951594
// ===========================================
15961595

15971596
/**
15981597
* Method allows you to add a new load balancer to distribute traffic across multiple Droplets.
15991598
*
1600-
* The LoadBalancer object passed in param can have a list of dropletIds set as dropletIds attribute.
1601-
* In this case, given Droplets will be assigned to the Load Balancer.
1599+
* The LoadBalancer object passed in param can have a list of dropletIds set as dropletIds
1600+
* attribute. In this case, given Droplets will be assigned to the Load Balancer.
16021601
*
1603-
* You may also use a Droplet tag to assign a group of Droplets to Load Balancer in place of a list of Droplet IDs.
1604-
* In this case, set the tag attribute of the LoadBalancer object passed in param.
1602+
* You may also use a Droplet tag to assign a group of Droplets to Load Balancer in place of a
1603+
* list of Droplet IDs. In this case, set the tag attribute of the LoadBalancer object passed in
1604+
* param.
16051605
*
16061606
* @param loadBalancer the instance of the loadBalancer class
16071607
* @return {@link LoadBalancer}
@@ -1614,7 +1614,6 @@ Delete deleteSnapshot(String snapshotId)
16141614
LoadBalancer createLoadBalancer(LoadBalancer loadBalancer) throws DigitalOceanException,
16151615
RequestUnsuccessfulException;
16161616

1617-
16181617
/**
16191618
* Method returns complete information for given load balancer ID.
16201619
*
@@ -1630,8 +1629,8 @@ LoadBalancer getLoadBalancerInfo(String loadBalancerId)
16301629
throws DigitalOceanException, RequestUnsuccessfulException;
16311630

16321631
/**
1633-
* Method returns all active loadbalancers that are currently running in your account. All available
1634-
* API information is presented for each loadbalancer.
1632+
* Method returns all active loadbalancers that are currently running in your account. All
1633+
* available API information is presented for each loadbalancer.
16351634
*
16361635
* @param pageNo for pagination
16371636
* @param perPage no. of items per page
@@ -1646,10 +1645,10 @@ LoadBalancers getAvailableLoadBalancers(Integer pageNo, Integer perPage)
16461645
throws DigitalOceanException, RequestUnsuccessfulException;
16471646

16481647
/**
1649-
* Method allows you to update an existign load balancer.
1650-
* The LoadBalancer object passed in param should contain a full representation of the Load Balancer including existing attributes.
1651-
* It may contain one of the dropletIds or tag parameter as they are mutually exclusive.
1652-
* Note that any attribute that is not provided will be reset to its default value.
1648+
* Method allows you to update an existign load balancer. The LoadBalancer object passed in param
1649+
* should contain a full representation of the Load Balancer including existing attributes. It may
1650+
* contain one of the dropletIds or tag parameter as they are mutually exclusive. Note that any
1651+
* attribute that is not provided will be reset to its default value.
16531652
*
16541653
* @param loadBalancer the instance of the loadBalancer class
16551654
* @return {@link LoadBalancer}
@@ -1666,64 +1665,73 @@ LoadBalancer updateLoadBalancer(LoadBalancer loadBalancer) throws DigitalOceanEx
16661665
* Method allows you to assign a Droplet to a Load Balancer instance.
16671666
*
16681667
* @param loadBalancerId the id of the loadBalancer
1669-
* @param dropletIds an array containing the IDs of the Droplets to be assigned to the Load Balancer instance.
1668+
* @param dropletIds an array containing the IDs of the Droplets to be assigned to the Load
1669+
* Balancer instance.
16701670
* @return {@link Response}
16711671
* @throws DigitalOceanException if request had interruption [
16721672
* <code>HTTP status code &gt;= 400 &amp;&amp; &lt; 510</code>]
16731673
* @throws RequestUnsuccessfulException if any RESTful request unsuccessful from wrapper method
16741674
*
16751675
* @since v2.11
16761676
*/
1677-
Response addDropletsToLoadBalancer(String loadBalancerId, List<Integer> dropletIds) throws DigitalOceanException,
1677+
Response addDropletsToLoadBalancer(String loadBalancerId, List<Integer> dropletIds)
1678+
throws DigitalOceanException,
16781679
RequestUnsuccessfulException;
16791680

16801681
/**
16811682
* Method allows you to remove a Droplet from a Load Balancer instance.
16821683
*
16831684
* @param loadBalancerId the id of the loadBalancer
1684-
* @param dropletIds an array containing the IDs of the Droplets to be removed from the Load Balancer instance.
1685+
* @param dropletIds an array containing the IDs of the Droplets to be removed from the Load
1686+
* Balancer instance.
16851687
* @return {@link Delete}
16861688
* @throws DigitalOceanException if request had interruption [
16871689
* <code>HTTP status code &gt;= 400 &amp;&amp; &lt; 510</code>]
16881690
* @throws RequestUnsuccessfulException if any RESTful request unsuccessful from wrapper method
16891691
*
16901692
* @since v2.11
16911693
*/
1692-
Delete removeDropletsFromLoadBalancer(String loadBalancerId, List<Integer> dropletIds) throws DigitalOceanException,
1694+
Delete removeDropletsFromLoadBalancer(String loadBalancerId, List<Integer> dropletIds)
1695+
throws DigitalOceanException,
16931696
RequestUnsuccessfulException;
16941697

16951698
/**
16961699
* Method allows you to add an additional forwarding rule to a Load Balancer instance.
16971700
*
16981701
* @param loadBalancerId the id of the loadBalancer
1699-
* @param forwardingRules an array containing the Forwarding Rules to add to the Load Balancer instance.
1702+
* @param forwardingRules an array containing the Forwarding Rules to add to the Load Balancer
1703+
* instance.
17001704
* @return {@link Response}
17011705
* @throws DigitalOceanException if request had interruption [
17021706
* <code>HTTP status code &gt;= 400 &amp;&amp; &lt; 510</code>]
17031707
* @throws RequestUnsuccessfulException if any RESTful request unsuccessful from wrapper method
17041708
*
17051709
* @since v2.11
17061710
*/
1707-
Response addForwardingRulesToLoadBalancer(String loadBalancerId, List<ForwardingRules> forwardingRules) throws DigitalOceanException,
1711+
Response addForwardingRulesToLoadBalancer(String loadBalancerId,
1712+
List<ForwardingRules> forwardingRules) throws DigitalOceanException,
17081713
RequestUnsuccessfulException;
17091714

17101715
/**
17111716
* Method allows you to remove forwarding rules from a Load Balancer instance.
17121717
*
17131718
* @param loadBalancerId the id of the loadBalancer
1714-
* @param forwardingRules an array containing the Forwarding Rules to remove from the Load Balancer instance.
1719+
* @param forwardingRules an array containing the Forwarding Rules to remove from the Load
1720+
* Balancer instance.
17151721
* @return {@link Delete}
17161722
* @throws DigitalOceanException if request had interruption [
17171723
* <code>HTTP status code &gt;= 400 &amp;&amp; &lt; 510</code>]
17181724
* @throws RequestUnsuccessfulException if any RESTful request unsuccessful from wrapper method
17191725
*
17201726
* @since v2.11
17211727
*/
1722-
Delete removeForwardingRulesFromLoadBalancer(String loadBalancerId, List<ForwardingRules> forwardingRules) throws DigitalOceanException,
1728+
Delete removeForwardingRulesFromLoadBalancer(String loadBalancerId,
1729+
List<ForwardingRules> forwardingRules) throws DigitalOceanException,
17231730
RequestUnsuccessfulException;
17241731

17251732
/**
1726-
* Method allows you to delete a Load Balancer instance, disassociating any Droplets assigned to it and removing it from your account.
1733+
* Method allows you to delete a Load Balancer instance, disassociating any Droplets assigned to
1734+
* it and removing it from your account.
17271735
*
17281736
* @param loadBalancerId the id of the loadBalancer
17291737
* @return {@link Delete}

src/main/java/com/myjeeva/digitalocean/common/ActionStatus.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
package com.myjeeva.digitalocean.common;
2323

24+
import org.apache.commons.lang3.StringUtils;
25+
2426
import com.google.gson.annotations.SerializedName;
2527

2628
/**
@@ -43,7 +45,7 @@ public enum ActionStatus {
4345

4446
private String value;
4547

46-
ActionStatus(String value) {
48+
private ActionStatus(String value) {
4749
this.value = value;
4850
}
4951

@@ -53,7 +55,7 @@ public String toString() {
5355
}
5456

5557
public static ActionStatus fromValue(String value) {
56-
if (null == value || "".equals(value)) {
58+
if (StringUtils.isBlank(value)) {
5759
throw new IllegalArgumentException("Value cannot be null or empty!");
5860
}
5961

src/main/java/com/myjeeva/digitalocean/common/ActionType.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
package com.myjeeva.digitalocean.common;
2323

24+
import org.apache.commons.lang3.StringUtils;
25+
2426
import com.google.gson.annotations.SerializedName;
2527

2628
/**
@@ -118,7 +120,7 @@ public enum ActionType {
118120

119121
private String value;
120122

121-
ActionType(String value) {
123+
private ActionType(String value) {
122124
this.value = value;
123125
}
124126

@@ -128,7 +130,7 @@ public String toString() {
128130
}
129131

130132
public static ActionType fromValue(String value) {
131-
if (null == value || "".equals(value)) {
133+
if (StringUtils.isBlank(value)) {
132134
throw new IllegalArgumentException("Value cannot be null or empty!");
133135
}
134136

src/main/java/com/myjeeva/digitalocean/common/DropletStatus.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
package com.myjeeva.digitalocean.common;
2323

24+
import org.apache.commons.lang3.StringUtils;
25+
2426
import com.google.gson.annotations.SerializedName;
2527

2628
/**
@@ -57,7 +59,7 @@ public String toString() {
5759
}
5860

5961
public static DropletStatus fromValue(String value) {
60-
if (null == value || "".equals(value)) {
62+
if (StringUtils.isBlank(value)) {
6163
throw new IllegalArgumentException("Value cannot be null or empty!");
6264
}
6365

src/main/java/com/myjeeva/digitalocean/common/ImageType.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
package com.myjeeva.digitalocean.common;
2323

24+
import org.apache.commons.lang3.StringUtils;
25+
2426
import com.google.gson.annotations.SerializedName;
2527

2628
/**
@@ -48,7 +50,7 @@ public enum ImageType {
4850

4951
private String value;
5052

51-
ImageType(String value) {
53+
private ImageType(String value) {
5254
this.value = value;
5355
}
5456

@@ -58,7 +60,7 @@ public String toString() {
5860
}
5961

6062
public static ImageType fromValue(String value) {
61-
if (null == value || "".equals(value)) {
63+
if (StringUtils.isBlank(value)) {
6264
throw new IllegalArgumentException("Value cannot be null or empty!");
6365
}
6466

src/main/java/com/myjeeva/digitalocean/common/LoadBalancerStatus.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
package com.myjeeva.digitalocean.common;
2323

24+
import org.apache.commons.lang3.StringUtils;
25+
2426
import com.google.gson.annotations.SerializedName;
2527

2628
/**
@@ -48,7 +50,7 @@ private LoadBalancerStatus(String value) {
4850
}
4951

5052
public static LoadBalancerStatus fromValue(String value) {
51-
if (null == value || "".equals(value)) {
53+
if (StringUtils.isBlank(value)) {
5254
throw new IllegalArgumentException("Value cannot be null or empty!");
5355
}
5456

src/main/java/com/myjeeva/digitalocean/common/LoadBalancingAlgorithm.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
package com.myjeeva.digitalocean.common;
2323

24+
import org.apache.commons.lang3.StringUtils;
25+
2426
import com.google.gson.annotations.SerializedName;
2527

2628
/**
@@ -45,7 +47,7 @@ private LoadBalancingAlgorithm(String value) {
4547
}
4648

4749
public static LoadBalancingAlgorithm fromValue(String value) {
48-
if (null == value || "".equals(value)) {
50+
if (StringUtils.isBlank(value)) {
4951
throw new IllegalArgumentException("Value cannot be null or empty!");
5052
}
5153

src/main/java/com/myjeeva/digitalocean/common/Protocol.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
package com.myjeeva.digitalocean.common;
2323

24+
import org.apache.commons.lang3.StringUtils;
25+
2426
import com.google.gson.annotations.SerializedName;
2527

2628
/**
@@ -48,7 +50,7 @@ private Protocol(String value) {
4850
}
4951

5052
public static Protocol fromValue(String value) {
51-
if (null == value || "".equals(value)) {
53+
if (StringUtils.isBlank(value)) {
5254
throw new IllegalArgumentException("Value cannot be null or empty!");
5355
}
5456

src/main/java/com/myjeeva/digitalocean/common/ResourceType.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
package com.myjeeva.digitalocean.common;
2323

24+
import org.apache.commons.lang3.StringUtils;
25+
2426
import com.google.gson.annotations.SerializedName;
2527

2628
/**
@@ -53,7 +55,7 @@ public enum ResourceType {
5355

5456
private String value;
5557

56-
ResourceType(String value) {
58+
private ResourceType(String value) {
5759
this.value = value;
5860
}
5961

@@ -63,7 +65,7 @@ public String toString() {
6365
}
6466

6567
public static ResourceType fromValue(String value) {
66-
if (null == value || "".equals(value)) {
68+
if (StringUtils.isBlank(value)) {
6769
throw new IllegalArgumentException("Value cannot be null or empty!");
6870
}
6971

src/main/java/com/myjeeva/digitalocean/common/StickySessionType.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
package com.myjeeva.digitalocean.common;
2323

24+
import org.apache.commons.lang3.StringUtils;
25+
2426
import com.google.gson.annotations.SerializedName;
2527

2628
/**
@@ -45,7 +47,7 @@ private StickySessionType(String value) {
4547
}
4648

4749
public static StickySessionType fromValue(String value) {
48-
if (null == value || "".equals(value)) {
50+
if (StringUtils.isBlank(value)) {
4951
throw new IllegalArgumentException("Value cannot be null or empty!");
5052
}
5153

0 commit comments

Comments
 (0)