12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package cn.com.qmth.examcloud.commons.helpers;
- /**
- * 基本类型对象化
- *
- * @author WANGWEI
- * @date 2019年1月16日
- * @Copyright (c) 2018-2020 http://www.qmth.com.cn/ All Rights Reserved.
- * @param <T>
- */
- public class ObjectHolder<T> {
- private T t;
- /**
- * 构造函数
- *
- * @param t
- */
- public ObjectHolder(T t) {
- super();
- this.t = t;
- }
- public T get() {
- return t;
- }
- public void set(T t) {
- this.t = t;
- }
- public boolean isNull() {
- return null == t;
- }
- @Override
- public String toString() {
- if (isNull()) {
- return super.toString();
- } else {
- return t.toString();
- }
- }
- }
|