From 63d88eb8db1f7a6d5924ec2a8b7f462373d5ac9a Mon Sep 17 00:00:00 2001 From: bjculkin Date: Fri, 7 Apr 2017 10:51:31 -0400 Subject: Cleanup --- .../main/java/bjc/utils/data/SingleSupplier.java | 34 +++++----------------- 1 file changed, 7 insertions(+), 27 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/SingleSupplier.java') 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 0bf1a93..fde5111 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/data/SingleSupplier.java +++ b/BJC-Utils2/src/main/java/bjc/utils/data/SingleSupplier.java @@ -43,9 +43,11 @@ public class SingleSupplier implements Supplier { @Override public T get() { - if(gotten == true) { - IllegalStateException isex = new IllegalStateException("Attempted to get value more than once" - + " from single supplier #" + id + ". Previous instantiation below."); + if (gotten == true) { + String msg = String.format( + "Attempted to retrieve value more than once from single supplier #%d", id); + + IllegalStateException isex = new IllegalStateException(msg); isex.initCause(instSite); @@ -56,7 +58,7 @@ public class SingleSupplier implements Supplier { try { throw new IllegalStateException("Previous instantiation here."); - } catch(IllegalStateException isex) { + } catch (IllegalStateException isex) { instSite = isex; } @@ -65,28 +67,6 @@ public class SingleSupplier implements Supplier { @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(); + return String.format("SingleSupplier [source='%s', gotten=%s, id=%s]", source, gotten, id); } } -- cgit v1.2.3