Class NamedValue<T>

java.lang.Object
org.tentackle.misc.NamedValue<T>
Type Parameters:
T - the value type

public class NamedValue<T> extends Object
Thread-safe named value.
See Also:
  • Constructor Details

    • NamedValue

      public NamedValue()
      Creates a named counter.
  • Method Details

    • get

      public T get(String name)
      Gets the value for given name.
      Parameters:
      name - the value's name
      Returns:
      the value
    • set

      public void set(String name, T value)
      Sets the value for given name.
      Parameters:
      name - the value's name
      value - the value
    • names

      public Collection<String> names()
      Gets the names of all values.
      Returns:
      the names
    • getReference

      protected AtomicReference<T> getReference(String name)
      Gets the atomic reference.
      Parameters:
      name - the value's name
      Returns:
      the atomic reference