|
@@ -4,9 +4,12 @@ package cn.com.qmth.examcloud.commons.helpers;
|
|
* 基本类型对象化
|
|
* 基本类型对象化
|
|
*
|
|
*
|
|
* @author WANGWEI
|
|
* @author WANGWEI
|
|
|
|
+ * @date 2019年1月16日
|
|
|
|
+ * @Copyright (c) 2018-2020 WANGWEI [QQ:522080330] All Rights Reserved.
|
|
* @param <T>
|
|
* @param <T>
|
|
*/
|
|
*/
|
|
public class ObjectHolder<T> {
|
|
public class ObjectHolder<T> {
|
|
|
|
+
|
|
private T t;
|
|
private T t;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -19,11 +22,11 @@ public class ObjectHolder<T> {
|
|
this.t = t;
|
|
this.t = t;
|
|
}
|
|
}
|
|
|
|
|
|
- public T getT() {
|
|
|
|
|
|
+ public T get() {
|
|
return t;
|
|
return t;
|
|
}
|
|
}
|
|
|
|
|
|
- public void setT(T t) {
|
|
|
|
|
|
+ public void set(T t) {
|
|
this.t = t;
|
|
this.t = t;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -31,8 +34,13 @@ public class ObjectHolder<T> {
|
|
return null == t;
|
|
return null == t;
|
|
}
|
|
}
|
|
|
|
|
|
- public T get() {
|
|
|
|
- return t;
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public String toString() {
|
|
|
|
+ if (isNull()) {
|
|
|
|
+ return super.toString();
|
|
|
|
+ } else {
|
|
|
|
+ return t.toString();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
-}
|
|
|
|
|
|
+}
|