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:
  • 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