Skip to content

Commit a12371e

Browse files
authored
Merge pull request #414 from davidxia/quantity-formatting
Fix formatting in Quantity.java
2 parents 0b64a0a + 7483dc9 commit a12371e

File tree

1 file changed

+61
-61
lines changed
  • kubernetes/src/main/java/io/kubernetes/client/custom

1 file changed

+61
-61
lines changed

kubernetes/src/main/java/io/kubernetes/client/custom/Quantity.java

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -14,81 +14,81 @@
1414
@JsonAdapter(Quantity.QuantityAdapter.class)
1515
public class Quantity {
1616

17-
private final BigDecimal number;
18-
private Format format;
17+
private final BigDecimal number;
18+
private Format format;
1919

20-
public enum Format {
21-
DECIMAL_EXPONENT(10), DECIMAL_SI(10), BINARY_SI(2);
20+
public enum Format {
21+
DECIMAL_EXPONENT(10), DECIMAL_SI(10), BINARY_SI(2);
2222

23-
private int base;
23+
private int base;
2424

25-
Format(final int base) {
26-
this.base = base;
27-
}
28-
29-
public int getBase() {
30-
return base;
31-
}
25+
Format(final int base) {
26+
this.base = base;
3227
}
3328

34-
public Quantity(final BigDecimal number, final Format format) {
35-
this.number = number;
36-
this.format = format;
29+
public int getBase() {
30+
return base;
3731
}
38-
39-
public Quantity(final String value) {
40-
this.number = fromString(value).number;
41-
this.format = fromString(value).format;
32+
}
33+
34+
public Quantity(final BigDecimal number, final Format format) {
35+
this.number = number;
36+
this.format = format;
37+
}
38+
39+
public Quantity(final String value) {
40+
this.number = fromString(value).number;
41+
this.format = fromString(value).format;
42+
}
43+
44+
public BigDecimal getNumber() {
45+
return number;
46+
}
47+
48+
public Format getFormat() {
49+
return format;
50+
}
51+
52+
public static Quantity fromString(final String value) {
53+
return new QuantityFormatter().parse(value);
54+
}
55+
56+
public String toSuffixedString() {
57+
return new QuantityFormatter().format(this);
58+
}
59+
60+
@Override
61+
public String toString() {
62+
return "Quantity{" +
63+
"number=" + number +
64+
", format=" + format +
65+
'}';
66+
}
67+
68+
@Override
69+
public boolean equals(Object o) {
70+
if (this == o) {
71+
return true;
4272
}
43-
44-
public BigDecimal getNumber() {
45-
return number;
46-
}
47-
48-
public Format getFormat() {
49-
return format;
73+
if (o == null || getClass() != o.getClass()) {
74+
return false;
5075
}
5176

52-
public static Quantity fromString(final String value) {
53-
return new QuantityFormatter().parse(value);
54-
}
77+
Quantity otherQuantity = (Quantity) o;
5578

56-
public String toSuffixedString() {
57-
return new QuantityFormatter().format(this);
58-
}
79+
return ObjectUtils.compare(this.number, otherQuantity.number) == 0 &&
80+
Objects.equals(this.format, otherQuantity.format);
81+
}
5982

83+
public class QuantityAdapter extends TypeAdapter<Quantity> {
6084
@Override
61-
public String toString() {
62-
return "Quantity{" +
63-
"number=" + number +
64-
", format=" + format +
65-
'}';
85+
public void write(JsonWriter jsonWriter, Quantity quantity) throws IOException {
86+
jsonWriter.value(quantity.toSuffixedString());
6687
}
6788

6889
@Override
69-
public boolean equals(Object o) {
70-
if (this == o) {
71-
return true;
72-
}
73-
if (o == null || getClass() != o.getClass()) {
74-
return false;
75-
}
76-
77-
Quantity otherQuantity = (Quantity) o;
78-
79-
return ObjectUtils.compare(this.number, otherQuantity.number) == 0 &&
80-
Objects.equals(this.format, otherQuantity.format);
81-
}
82-
83-
public class QuantityAdapter extends TypeAdapter<Quantity> {
84-
@Override
85-
public void write(JsonWriter jsonWriter, Quantity quantity) throws IOException {
86-
jsonWriter.value(quantity.toSuffixedString());
87-
}
88-
89-
@Override
90-
public Quantity read(JsonReader jsonReader) throws IOException {
91-
return Quantity.fromString(jsonReader.nextString());
92-
}
90+
public Quantity read(JsonReader jsonReader) throws IOException {
91+
return Quantity.fromString(jsonReader.nextString());
9392
}
93+
}
9494
}

0 commit comments

Comments
 (0)