FieldReference.java 582 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
package com.alibaba.tenant;

public class FieldReference<T> {
    private T referent;
    /**
     * Constructs a new FieldReference with r as the referent
     * @param r The object to which this FieldReference points
     */
    public FieldReference(T r) {
        this.referent = r;
    }
    /**
     * Returns this FieldReference referent
     * @return The referent
     */
    public T get() {
        return referent;
    }

    /**
     * Sets {@code referent}
     * @param t The new referent value
     */
    public void set(Object t) {
        referent = (T)t;
    }
}