澧炲姞ObjectReference宸ュ叿绫?
This commit is contained in:
41
src/main/java/org/redkale/util/ObjectReference.java
Normal file
41
src/main/java/org/redkale/util/ObjectReference.java
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
*
|
||||
*/
|
||||
package org.redkale.util;
|
||||
|
||||
/**
|
||||
* 简单的对象引用
|
||||
*
|
||||
* <p>
|
||||
* 详情见: https://redkale.org
|
||||
*
|
||||
* @param <V> 泛型
|
||||
*
|
||||
* @author zhangjx
|
||||
*
|
||||
* @since 2.8.0
|
||||
*/
|
||||
public final class ObjectReference<V> {
|
||||
|
||||
private V value;
|
||||
|
||||
public ObjectReference(V initialValue) {
|
||||
value = initialValue;
|
||||
}
|
||||
|
||||
public ObjectReference() {
|
||||
}
|
||||
|
||||
public final V get() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public final void set(V newValue) {
|
||||
value = newValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user