Skip to content

Commit 924458f

Browse files
author
Lewis Headden
committed
Use Commons Pair
1 parent a295a5d commit 924458f

File tree

5 files changed

+127
-131
lines changed

5 files changed

+127
-131
lines changed

kubernetes/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@
153153
<artifactId>joda-time</artifactId>
154154
<version>${jodatime-version}</version>
155155
</dependency>
156+
<dependency>
157+
<groupId>org.apache.commons</groupId>
158+
<artifactId>commons-lang3</artifactId>
159+
</dependency>
156160
<!-- test dependencies -->
157161
<dependency>
158162
<groupId>junit</groupId>

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

Lines changed: 0 additions & 20 deletions
This file was deleted.

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.kubernetes.client.custom;
22

3+
import org.apache.commons.lang3.tuple.Pair;
4+
35
import java.math.BigDecimal;
46
import java.math.MathContext;
57

@@ -68,11 +70,11 @@ private String toBase10String(final Quantity quantity) {
6870
private Pair<Long, Integer> ensureExponentIsMultipleOf3(final long mantissa, final int exponent) {
6971
final long exponentRemainder = exponent % 3;
7072
if (exponentRemainder == 1 || exponentRemainder == -2) {
71-
return new Pair<>(mantissa * 10, exponent - 1);
73+
return Pair.of(mantissa * 10, exponent - 1);
7274
} else if (exponentRemainder == -1 || exponentRemainder == 2) {
73-
return new Pair<>(mantissa * 100, exponent - 2);
75+
return Pair.of(mantissa * 100, exponent - 2);
7476
} else {
75-
return new Pair<>(mantissa, exponent);
77+
return Pair.of(mantissa, exponent);
7678
}
7779
}
7880

@@ -83,7 +85,7 @@ private Pair<Long, Integer> removeFactorsForBase(final long value, final int bas
8385
times++;
8486
result = result / base;
8587
}
86-
return new Pair<>(result, times);
88+
return Pair.of(result, times);
8789
}
8890

8991
}

pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@
4343
</developer>
4444
</developers>
4545

46+
<dependencyManagement>
47+
<dependencies>
48+
<dependency>
49+
<groupId>org.apache.commons</groupId>
50+
<artifactId>commons-lang3</artifactId>
51+
<version>3.7</version>
52+
</dependency>
53+
</dependencies>
54+
</dependencyManagement>
55+
4656
<distributionManagement>
4757
<snapshotRepository>
4858
<id>ossrh</id>

util/pom.xml

Lines changed: 107 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,109 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2-
<modelVersion>4.0.0</modelVersion>
3-
<groupId>io.kubernetes</groupId>
4-
<artifactId>client-java</artifactId>
5-
<version>1.0.0-beta2-SNAPSHOT</version>
6-
<packaging>jar</packaging>
7-
<name>client-java</name>
8-
<url>https://github.com/kubernetes-client/java</url>
9-
<parent>
10-
<groupId>io.kubernetes</groupId>
11-
<artifactId>client-java-parent</artifactId>
12-
<version>1.0.0-beta2-SNAPSHOT</version>
13-
</parent>
14-
<dependencies>
15-
<dependency>
16-
<groupId>io.kubernetes</groupId>
17-
<artifactId>client-java-api</artifactId>
18-
<version>1.0.0-beta2-SNAPSHOT</version>
19-
</dependency>
20-
<dependency>
21-
<groupId>io.kubernetes</groupId>
22-
<artifactId>client-java-proto</artifactId>
23-
<version>1.0.0-beta2-SNAPSHOT</version>
24-
</dependency>
25-
<dependency>
26-
<groupId>org.yaml</groupId>
27-
<artifactId>snakeyaml</artifactId>
28-
<version>1.18</version>
29-
</dependency>
30-
<dependency>
31-
<groupId>commons-codec</groupId>
32-
<artifactId>commons-codec</artifactId>
33-
<version>1.10</version>
34-
</dependency>
35-
<dependency>
36-
<groupId>commons-lang</groupId>
37-
<artifactId>commons-lang</artifactId>
38-
<version>2.6</version>
39-
</dependency>
40-
<dependency>
41-
<groupId>com.squareup.okhttp</groupId>
42-
<artifactId>okhttp-ws</artifactId>
43-
<version>2.7.5</version>
44-
</dependency>
45-
<dependency>
46-
<groupId>com.google.guava</groupId>
47-
<artifactId>guava</artifactId>
48-
<version>22.0</version>
49-
</dependency>
50-
<dependency>
51-
<groupId>log4j</groupId>
52-
<artifactId>log4j</artifactId>
53-
<version>1.2.17</version>
54-
</dependency>
55-
<!-- test dependencies -->
56-
<dependency>
57-
<groupId>junit</groupId>
58-
<artifactId>junit</artifactId>
59-
<version>4.12</version>
60-
<scope>test</scope>
61-
</dependency>
62-
<dependency>
63-
<groupId>com.github.stefanbirkner</groupId>
64-
<artifactId>system-rules</artifactId>
65-
<version>1.16.1</version>
66-
</dependency>
67-
<dependency>
68-
<groupId>com.google.protobuf</groupId>
69-
<artifactId>protobuf-java</artifactId>
70-
<version>3.4.0</version>
71-
</dependency>
72-
</dependencies>
73-
<build>
74-
<plugins>
75-
<plugin>
76-
<groupId>org.apache.maven.plugins</groupId>
77-
<artifactId>maven-compiler-plugin</artifactId>
78-
<version>3.1</version>
79-
<configuration>
80-
<source>1.7</source>
81-
<target>1.7</target>
82-
</configuration>
83-
</plugin>
84-
<plugin>
85-
<groupId>org.apache.maven.plugins</groupId>
86-
<artifactId>maven-surefire-plugin</artifactId>
87-
<version>2.12</version>
88-
<configuration>
89-
<systemProperties>
90-
<property>
91-
<name>loggerPath</name>
92-
<value>conf/log4j.properties</value>
93-
</property>
94-
</systemProperties>
95-
<argLine>-Xms512m -Xmx1500m</argLine>
96-
<parallel>methods</parallel>
97-
<forkMode>pertest</forkMode>
98-
</configuration>
99-
</plugin>
100-
</plugins>
101-
</build>
102-
<properties>
103-
<java.version>1.7</java.version>
104-
<maven.compiler.source>${java.version}</maven.compiler.source>
105-
<maven.compiler.target>${java.version}</maven.compiler.target>
106-
<slf4jVersion>1.7.7</slf4jVersion>
107-
</properties>
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>io.kubernetes</groupId>
5+
<artifactId>client-java</artifactId>
6+
<version>1.0.0-beta2-SNAPSHOT</version>
7+
<packaging>jar</packaging>
8+
<name>client-java</name>
9+
<url>https://github.com/kubernetes-client/java</url>
10+
<parent>
11+
<groupId>io.kubernetes</groupId>
12+
<artifactId>client-java-parent</artifactId>
13+
<version>1.0.0-beta2-SNAPSHOT</version>
14+
</parent>
15+
<dependencies>
16+
<dependency>
17+
<groupId>io.kubernetes</groupId>
18+
<artifactId>client-java-api</artifactId>
19+
<version>1.0.0-beta2-SNAPSHOT</version>
20+
</dependency>
21+
<dependency>
22+
<groupId>io.kubernetes</groupId>
23+
<artifactId>client-java-proto</artifactId>
24+
<version>1.0.0-beta2-SNAPSHOT</version>
25+
</dependency>
26+
<dependency>
27+
<groupId>org.yaml</groupId>
28+
<artifactId>snakeyaml</artifactId>
29+
<version>1.18</version>
30+
</dependency>
31+
<dependency>
32+
<groupId>commons-codec</groupId>
33+
<artifactId>commons-codec</artifactId>
34+
<version>1.10</version>
35+
</dependency>
36+
<dependency>
37+
<groupId>org.apache.commons</groupId>
38+
<artifactId>commons-lang3</artifactId>
39+
</dependency>
40+
<dependency>
41+
<groupId>com.squareup.okhttp</groupId>
42+
<artifactId>okhttp-ws</artifactId>
43+
<version>2.7.5</version>
44+
</dependency>
45+
<dependency>
46+
<groupId>com.google.guava</groupId>
47+
<artifactId>guava</artifactId>
48+
<version>22.0</version>
49+
</dependency>
50+
<dependency>
51+
<groupId>log4j</groupId>
52+
<artifactId>log4j</artifactId>
53+
<version>1.2.17</version>
54+
</dependency>
55+
<!-- test dependencies -->
56+
<dependency>
57+
<groupId>junit</groupId>
58+
<artifactId>junit</artifactId>
59+
<version>4.12</version>
60+
<scope>test</scope>
61+
</dependency>
62+
<dependency>
63+
<groupId>com.github.stefanbirkner</groupId>
64+
<artifactId>system-rules</artifactId>
65+
<version>1.16.1</version>
66+
</dependency>
67+
<dependency>
68+
<groupId>com.google.protobuf</groupId>
69+
<artifactId>protobuf-java</artifactId>
70+
<version>3.4.0</version>
71+
</dependency>
72+
</dependencies>
73+
<build>
74+
<plugins>
75+
<plugin>
76+
<groupId>org.apache.maven.plugins</groupId>
77+
<artifactId>maven-compiler-plugin</artifactId>
78+
<version>3.1</version>
79+
<configuration>
80+
<source>1.7</source>
81+
<target>1.7</target>
82+
</configuration>
83+
</plugin>
84+
<plugin>
85+
<groupId>org.apache.maven.plugins</groupId>
86+
<artifactId>maven-surefire-plugin</artifactId>
87+
<version>2.12</version>
88+
<configuration>
89+
<systemProperties>
90+
<property>
91+
<name>loggerPath</name>
92+
<value>conf/log4j.properties</value>
93+
</property>
94+
</systemProperties>
95+
<argLine>-Xms512m -Xmx1500m</argLine>
96+
<parallel>methods</parallel>
97+
<forkMode>pertest</forkMode>
98+
</configuration>
99+
</plugin>
100+
</plugins>
101+
</build>
102+
<properties>
103+
<java.version>1.7</java.version>
104+
<maven.compiler.source>${java.version}</maven.compiler.source>
105+
<maven.compiler.target>${java.version}</maven.compiler.target>
106+
<slf4jVersion>1.7.7</slf4jVersion>
107+
</properties>
108108
</project>
109109

0 commit comments

Comments
 (0)