/** * Override toString to cache the value * * @return the String */ public String toString() { if (cacheToString() == false) return toStringImplementation(); String result = null; if (toString != null) result = (String) toString.get(); if (result == null) { result = toStringImplementation(); toString = new SoftReference(result); } return result; }