Formatting java codes with sbt-java-formatter.

This commit is contained in:
hepin1989 2019-01-12 04:00:53 +08:00
parent 27500001ea
commit 998c5a9285
401 changed files with 19750 additions and 17450 deletions

View file

@ -9,39 +9,41 @@ import akka.actor.ActorRef;
import java.util.function.Predicate;
/**
* Acts as if `System.out.println()` yet swallows all messages. Useful for putting printlines in examples yet without polluting the build with them.
* Acts as if `System.out.println()` yet swallows all messages. Useful for putting printlines in
* examples yet without polluting the build with them.
*/
public class SilenceSystemOut {
private SilenceSystemOut() {
}
private SilenceSystemOut() {}
public static System get() {
return new System(new System.Println() {
@Override
public void println(String s) {
// ignore
}
});
return new System(
new System.Println() {
@Override
public void println(String s) {
// ignore
}
});
}
public static System get(ActorRef probe) {
return new System(new System.Println() {
@Override
public void println(String s) {
probe.tell(s, ActorRef.noSender());
}
});
return new System(
new System.Println() {
@Override
public void println(String s) {
probe.tell(s, ActorRef.noSender());
}
});
}
public static System get(Predicate<String> filter, ActorRef probe) {
return new System(new System.Println() {
@Override
public void println(String s) {
if (filter.test(s))
probe.tell(s, ActorRef.noSender());
}
});
return new System(
new System.Println() {
@Override
public void println(String s) {
if (filter.test(s)) probe.tell(s, ActorRef.noSender());
}
});
}
public static class System {
@ -51,7 +53,7 @@ public class SilenceSystemOut {
this.out = out;
}
public static abstract class Println {
public abstract static class Println {
public abstract void println(String s);
public void println(Object s) {
@ -62,7 +64,5 @@ public class SilenceSystemOut {
println(String.format(format, args));
}
}
}
}