Remove unneeded dependencies, incl Guava

Fixes https://github.com/spring-projects/spring-shell/issues/95
This commit is contained in:
Eric Bottard
2016-12-15 16:28:16 +01:00
parent fe512af783
commit fdf892cfaf
3 changed files with 12 additions and 10 deletions

View File

@@ -44,7 +44,6 @@ dependencies {
compile "org.springframework:spring-core:$springVersion"
compile "org.springframework:spring-context-support:$springVersion"
compile "commons-io:commons-io:$commonsioVersion"
compile "com.google.guava:guava:$guavaVersion"
compile "jline:jline:$jlineVersion"
@@ -52,7 +51,6 @@ dependencies {
testCompile "junit:junit:$junitVersion"
testCompile "org.mockito:mockito-core:$mockitoVersion"
testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
testCompile "uk.co.modular-it:hamcrest-date:$hamcrestDateVersion"
}
sourceCompatibility = 1.6

View File

@@ -1,5 +1,4 @@
slf4jVersion=1.7.13
guavaVersion=17.0
jlineVersion=2.12
junitVersion=4.12
springVersion=4.2.4.RELEASE
@@ -7,4 +6,3 @@ commonsioVersion=2.4
hamcrestVersion=1.3
version=1.2.1.BUILD-SNAPSHOT
mockitoVersion=1.10.19
hamcrestDateVersion=0.9.3

View File

@@ -16,12 +16,11 @@
package org.springframework.shell.support.table;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import com.google.common.base.Splitter;
import org.springframework.shell.support.util.StringUtils;
/**
@@ -164,8 +163,7 @@ public final class TableRenderer {
for (TableHeader header : table.getHeaders().values()) {
if (header.getName().length() > header.getWidth()) {
Iterable<String> chunks = Splitter.fixedLength(
header.getWidth()).split(header.getName());
Iterable<String> chunks = split(header.getName(), header.getWidth());
int length = headerline.length();
boolean first = true;
for (String chunk : chunks) {
@@ -205,8 +203,7 @@ public final class TableRenderer {
.entrySet()) {
String value = row.getValue(entry.getKey());
if (value.length() > entry.getValue().getWidth()) {
Iterable<String> chunks = Splitter.fixedLength(
entry.getValue().getWidth()).split(value);
Iterable<String> chunks = split(value, entry.getValue().getWidth());
int length = rowLine.length();
boolean first = true;
for (String chunk : chunks) {
@@ -265,4 +262,13 @@ public final class TableRenderer {
return headerBorder.toString();
}
private static List<String> split(String in, int length) {
List<String> result = new ArrayList<String>(in.length() / length);
for (int i = 0; i < in.length(); i += length) {
result.add(in.substring(i, Math.min(in.length(), i + length)));
}
return result;
}
}