Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.github.dockerjava.api.command;

import static com.github.dockerjava.core.util.guava.Guava.join;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Joiner;

/**
*
Expand Down Expand Up @@ -32,12 +31,12 @@ public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append("[");
for(String[] fields: processes) {
buffer.append("[" + join(fields, "; ", true) + "]");
buffer.append("[" + Joiner.on("; ").skipNulls().join(fields) + "]");
}
buffer.append("]");

return "TopContainerResponse{" +
"titles=" + join(titles, "; ", true) +
"titles=" + Joiner.on("; ").skipNulls().join(titles) +
", processes=" + buffer.toString() +
'}';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,31 +66,7 @@ public Optional<? extends DockerfileStatement> apply(String input) {
}
}

/**
* Not needed in modern guava
*/
private static class MissingOptionalFilter
implements Predicate<Optional<? extends DockerfileStatement>> {

@Override
public boolean apply(Optional<? extends DockerfileStatement> optional) {
return (optional.orNull() != null);
}
}

/**
* Not needed in modern guava
*/
private static class OptionalItemTransformer
implements Function<Optional<? extends DockerfileStatement>, DockerfileStatement> {

@Override
public DockerfileStatement apply(Optional<? extends DockerfileStatement> optional) {
return optional.orNull();
}
}

public Collection<DockerfileStatement> getStatements() throws IOException {
public Iterable<DockerfileStatement> getStatements() throws IOException {
Collection<String> dockerFileContent = FileUtils.readLines(dockerFile);

if (dockerFileContent.size() <= 0) {
Expand All @@ -101,17 +77,7 @@ public Collection<DockerfileStatement> getStatements() throws IOException {
Collection<Optional<? extends DockerfileStatement>> optionals = Collections2
.transform(dockerFileContent, new LineTransformer());

// Modern guava would be done here,
// With simply return Optional.presentInstances( optionals );
//
// So this entire function could simply be
// return Optional.presentInstances( Collections2.transform( FileUtils.readLines(dockerFile), new LineTransformer() ) );
//
// Until the dawn of that day, do it manually

return Collections2.transform(Collections2.filter(optionals, new MissingOptionalFilter()),
new OptionalItemTransformer());

return Optional.presentInstances(optionals);
}

public List<String> getIgnores() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,13 @@ public static Optional<? extends DockerfileStatement> createFromLine(String cmd)

line = Add.create(cmd);

// if (line.isPresent()) { : Newer guava
if (line.orNull() != null) {
if (line.isPresent()) {
return line;
}

line = Env.create(cmd);

// if (line.isPresent()) { : Newer guava
if (line.orNull() != null) {
if (line.isPresent()) {
return line;
}

Expand Down
45 changes: 0 additions & 45 deletions src/main/java/com/github/dockerjava/core/util/guava/Guava.java

This file was deleted.

This file was deleted.

Loading