Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Fixed typo
- Removed unnecessary class UnitJson
  • Loading branch information
Javier Gómez committed Jul 29, 2016
1 parent 3c6dcb1 commit 647bf73
Showing 1 changed file with 5 additions and 50 deletions.
Expand Up @@ -157,7 +157,7 @@ private List<LimitJson> buildLimits(final Limit[] limits) {
List<LimitJson> limitsJson = new ArrayList<LimitJson>();
if (limits != null && limits.length > 0) {
for (int i=0; i < limits.length; i++) {
limitsJson.add(new LimitJson(new UnitJson(limits[i].getUnit().getName()),
limitsJson.add(new LimitJson(limits[i].getUnit().getName(),
limits[i].getMax().toString(),
limits[i].getMin().toString()));
}
Expand Down Expand Up @@ -446,7 +446,7 @@ public static class TieredBlockJson {
private final List<PriceJson> prices;

@JsonCreator
public TieredBlockJson(@JsonProperty("billingPeriod") final String unit,
public TieredBlockJson(@JsonProperty("unit") final String unit,
@JsonProperty("size") final String size,
@JsonProperty("max") final String max,
@JsonProperty("prices") final List<PriceJson> prices) {
Expand Down Expand Up @@ -517,66 +517,21 @@ public int hashCode() {
}
}

public static class UnitJson {
private final String name;

@JsonCreator
public UnitJson(@JsonProperty("name") final String name) {
this.name = name;
}

public String getName() {
return name;
}

@Override
public String toString() {
final StringBuilder sb = new StringBuilder("UnitJson{");
sb.append("name='").append(name).append('\'');
sb.append('}');
return sb.toString();
}

@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}

final UnitJson unitJson = (UnitJson) o;

if (name != null ? !name.equals(unitJson.name) : unitJson.name != null) {
return false;
}

return true;
}

@Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
return result;
}
}

public static class LimitJson {
private final UnitJson unit;
private final String unit;
private final String max;
private final String min;

@JsonCreator
public LimitJson(@JsonProperty("unit") final UnitJson unit,
public LimitJson(@JsonProperty("unit") final String unit,
@JsonProperty("max") final String max,
@JsonProperty("min") final String min) {
this.unit = unit;
this.max = max;
this.min = min;
}

public UnitJson getUnit() {
public String getUnit() {
return unit;
}
public String getMax() {
Expand Down

0 comments on commit 647bf73

Please sign in to comment.