diff options
| author | bjculkin <bjculkin@mix.wvu.edu> | 2017-03-17 19:28:59 -0400 |
|---|---|---|
| committer | bjculkin <bjculkin@mix.wvu.edu> | 2017-03-17 19:28:59 -0400 |
| commit | 5832ef0286430d04484b70d49c73e081a80ec9c7 (patch) | |
| tree | 04ab56561978c14415f71b934f7d8a3aaa1a037e /BJC-Utils2/src/main/java/bjc/utils/data/SingleSupplier.java | |
| parent | c8593896ba0d93c9512a71c2e70d1d503627b1b0 (diff) | |
Add more toString/hashCode/equals
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/SingleSupplier.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/data/SingleSupplier.java | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/SingleSupplier.java b/BJC-Utils2/src/main/java/bjc/utils/data/SingleSupplier.java index 76c9be2..0bf1a93 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/data/SingleSupplier.java +++ b/BJC-Utils2/src/main/java/bjc/utils/data/SingleSupplier.java @@ -10,6 +10,7 @@ import java.util.function.Supplier; * @author ben * * @param <T> + * The supplied type */ public class SingleSupplier<T> implements Supplier<T> { private static long nextID = 0; @@ -20,8 +21,10 @@ public class SingleSupplier<T> implements Supplier<T> { private long id; - // This is bad practice, but I want to know where the single - // instantiation was, in case of duplicate initiations + /* + * This is bad practice, but I want to know where the single + * instantiation was, in case of duplicate initiations. + */ private Exception instSite; /** @@ -59,4 +62,31 @@ public class SingleSupplier<T> implements Supplier<T> { return source.get(); } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("SingleSupplier ["); + + if(source != null) { + builder.append("source="); + builder.append(source); + builder.append(", "); + } + + builder.append("gotten="); + builder.append(gotten); + builder.append(", id="); + builder.append(id); + builder.append(", "); + + if(instSite != null) { + builder.append("instSite="); + builder.append(instSite); + } + + builder.append("]"); + + return builder.toString(); + } } |
