Package com.io7m.waxmill.cmdline.internal

# Class WXMNamedParameter<T>

java.lang.Object
com.io7m.waxmill.cmdline.internal.WXMNamedParameter<T>

All Implemented Interfaces:
  `WXMNamedParameterType<T>`

    public final class WXMNamedParameter<T>
    extends java.lang.Object
    implements WXMNamedParameterType<T>

Immutable implementation of `WXMNamedParameterType`.

Use the builder to create immutable instances: `WXMNamedParameter.builder()`. Use the static factory method to create immutable instances: `WXMNamedParameter.of()`.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type | Class | Description
  --- | --- | ---
  `static class` | `WXMNamedParameter.Builder<T>` | Builds instances of type `WXMNamedParameter`.

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `static <T> WXMNamedParameter.Builder<T>` | `builder()` | Creates a builder for `WXMNamedParameter`.
  `static <T> WXMNamedParameter<T>` | `copyOf​(WXMNamedParameterType<T> instance)` | Creates an immutable copy of a `WXMNamedParameterType` value.
  `boolean` | `equals​(java.lang.Object another)` | This instance is equal to all instances of `WXMNamedParameter` that have equal attribute values.
  `int` | `hashCode()` | Computes a hash code from attributes: `name`, `value`.
  `java.lang.String` | `name()` |
  `static <T> WXMNamedParameter<T>` | `of​(java.lang.String name, T value)` | Construct a new immutable `WXMNamedParameter` instance.
  `java.lang.String` | `toString()` | Prints the immutable value `WXMNamedParameter` with attribute values.
  `T` | `value()` |
  `WXMNamedParameter<T>` | `withName​(java.lang.String value)` | Copy the current immutable object by setting a value for the `name` attribute.
  `WXMNamedParameter<T>` | `withValue​(T value)` | Copy the current immutable object by setting a value for the `value` attribute.

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

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

- ## Method Details

  - ### name

    public java.lang.String name()
    Specified by:
      `name` in interface `WXMNamedParameterType<T>`
    Returns:
      The value of the `name` attribute

  - ### value

    public T value()
    Specified by:
      `value` in interface `WXMNamedParameterType<T>`
    Returns:
      The value of the `value` attribute

  - ### withName

    public final WXMNamedParameter<T> withName​(java.lang.String value)
    Copy the current immutable object by setting a value for the `name` attribute. An equals check used to prevent copying of the same value by returning `this`.
    Parameters:
      `value` - A new value for name
    Returns:
      A modified copy of the `this` object

  - ### withValue

    public final WXMNamedParameter<T> withValue​(T value)
    Copy the current immutable object by setting a value for the `value` attribute. A shallow reference equality check is used to prevent copying of the same value by returning `this`.
    Parameters:
      `value` - A new value for value
    Returns:
      A modified copy of the `this` object

  - ### equals

    public boolean equals​(java.lang.Object another)
    This instance is equal to all instances of `WXMNamedParameter` that have equal attribute values.
    Overrides:
      `equals` in class `java.lang.Object`
    Returns:
      `true` if `this` is equal to `another` instance

  - ### hashCode

    public int hashCode()
    Computes a hash code from attributes: `name`, `value`.
    Overrides:
      `hashCode` in class `java.lang.Object`
    Returns:
      hashCode value

  - ### toString

    public java.lang.String toString()
    Prints the immutable value `WXMNamedParameter` with attribute values.
    Overrides:
      `toString` in class `java.lang.Object`
    Returns:
      A string representation of the value

  - ### of

    public static <T> WXMNamedParameter<T> of​(java.lang.String name, T value)
    Construct a new immutable `WXMNamedParameter` instance.
    Type Parameters:
      `T` - generic parameter T
    Parameters:
      `name` - The value for the `name` attribute
      `value` - The value for the `value` attribute
    Returns:
      An immutable WXMNamedParameter instance

  - ### copyOf

    public static <T> WXMNamedParameter<T> copyOf​(WXMNamedParameterType<T> instance)
    Creates an immutable copy of a `WXMNamedParameterType` value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
    Type Parameters:
      `T` - generic parameter T
    Parameters:
      `instance` - The instance to copy
    Returns:
      A copied immutable WXMNamedParameter instance

  - ### builder

    public static <T> WXMNamedParameter.Builder<T> builder()
    Creates a builder for `WXMNamedParameter`.

         WXMNamedParameter.&lt;T&gt;builder()
            .setName(String) // required name
            .setValue(T) // required value
            .build();

    Type Parameters:
      `T` - generic parameter T
    Returns:
      A new WXMNamedParameter builder