All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jgroups.util.ImmutableReference Maven / Gradle / Ivy

There is a newer version: 9.1.7.Final
Show newest version

package org.jgroups.util;

/**
 * Simple class that holds an immutable reference to another object (or to
 * null).
 *
 * @author Brian Stansberry
 * 
 */
public class ImmutableReference {

    private final T referent;
    
    /** 
     * Create a new ImmutableReference.
     * 
     * @param referent the object to refer to, or null
     */
    public ImmutableReference(T referent) {
        this.referent = referent;
    }
    
    /**
     * Gets the wrapped object, if there is one.
     * 
     * @return the object passed to the constructor, or null if
     *         null was passed to the constructor
     */
    public T get() {
        return referent;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy