* @param obj object that will be wrapped
* @param soft true if a SoftReference should be created; otherwise Soft
* @return a Reference or null if obj is null.
*/
static Reference createReference(Object obj, boolean soft) {
Reference ref = null;
if (obj != null) {
if (soft) {
ref = new SoftReference(obj);
} else {
ref = new WeakReference(obj);