Package groovy.lang

# Class NamedValue<T>

java.lang.Object
groovy.lang.NamedValue<T>

Type Parameters:
  `T` - the value type

All Implemented Interfaces:
  `Serializable`

@Incubating public class NamedValue<T> extends Object implements Serializable
Represents a value with name

Since:
  4.0.0
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NamedValue(String name, T val)`
  Creates a named value pair.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object o)`
  `String`
  `getName()`
  Returns the name.
  `T`
  `getVal()`
  Returns the value.
  `int`
  `hashCode()`
  `String`
  `toString()`
  `String`
  `toString(Map<String,Object> options)`
  Returns the formatted `name=value` representation using the supplied formatting options.

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### NamedValue

    public NamedValue(String name, T val)
    Creates a named value pair.
    Parameters:
      `name` - the name
      `val` - the value

- ## Method Details

  - ### getName

    public String getName()
    Returns the name.
    Returns:
      the name

  - ### getVal

    public T getVal()
    Returns the value.
    Returns:
      the value

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### toString

    public String toString(Map<String,Object> options)
    Returns the formatted `name=value` representation using the supplied formatting options.
    Parameters:
      `options` - the formatting options to apply to the value
    Returns:
      the formatted named value