Class SimpleHolder<V>

  • Type Parameters:
    V - the value type
    All Implemented Interfaces:
    Holder<V>, Serializable
    Direct Known Subclasses:
    IdentityHolder, SimpleHolder

    public class SimpleHolder<V>
    extends Object
    implements Holder<V>, Serializable
    SimpleHolder is a basic implementation of the Holder interface.

    There value is simply held by a non-volatile reference, thus SimpleHolder does not provide any inter-thread visibility guarantees.

    Author:
    mf 2010.12.02
    See Also:
    Serialized Form
    • Field Detail

      • m_value

        protected V m_value
        The held value.
    • Constructor Detail

      • SimpleHolder

        public SimpleHolder()
        Construct a SimpleHolder with no value.
      • SimpleHolder

        public SimpleHolder​(V value)
        Construct a SimpleHolder with an initial value.
        Parameters:
        value - the initial value
    • Method Detail

      • set

        public void set​(V value)
        Specify the held object.
        Specified by:
        set in interface Holder<V>
        Parameters:
        value - the object to hold
      • get

        public V get()
        Return the held object.
        Specified by:
        get in interface Holder<V>
        Returns:
        the held object