org.gradle.api.attributes

## Class AttributeValue<T>

- java.lang.Object
- - org.gradle.api.attributes.AttributeValue<T>

- Type Parameters:
    `T` - the type of the attribute

      public class AttributeValue<T>
      extends Object

  Represents an optional attribute value, as found in an attribute container. There are 3 possible cases:
  - present is the default, and represents an attribute with an actual value
  - missing used whenever an attribute is known of the `AttributesSchema` of a consumer, no value was provided.
  - unknown used whenever an attribute is unknown of the `AttributesSchema` of a consumer, implying that no value was provided. It is different from the missing case in the sense that the consumer had no chance to provide a value here.
  During attribute matching, this can be used to implement various `strategies`.
  Since:
    3.3

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `T` | `get()` Returns the value of this attribute.
    `int` | `hashCode()`
    `boolean` | `isMissing()` Returns true if this attribute value is missing.
    `boolean` | `isPresent()` Tells if this attribute value is present.
    `boolean` | `isUnknown()` Returns true if this attribute value is unknown.
    `static <T> AttributeValue<T>` | `missing()` Creates a missing attribute value, used to represent the fact that the attribute is known but the consumer didn't want to express a value for it (it doesn't care).
    `static <T> AttributeValue<T>` | `of(T value)` Creates a valued attribute from a non-null value.
    `static <T> AttributeValue<T>` | `unknown()` Creates an unknown attribute value, used to represent the fact that the attribute is unknown from the consumer side.

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

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

- - ### Method Detail

    - #### of

          public static <T> AttributeValue<T> of(T value)

      Creates a valued attribute from a non-null value.
      Type Parameters:
        `T` - the type of the attribute
      Parameters:
        `value` - the value of the attribute
      Returns:
        a present attribute value

    - #### missing

          public static <T> AttributeValue<T> missing()

      Creates a missing attribute value, used to represent the fact that the attribute is known but the consumer didn't want to express a value for it (it doesn't care).
      Type Parameters:
        `T` - the type of the attribute
      Returns:
        a missing attribute value

    - #### unknown

          public static <T> AttributeValue<T> unknown()

      Creates an unknown attribute value, used to represent the fact that the attribute is unknown from the consumer side. Produces might want to do something differently in this case.
      Type Parameters:
        `T` - the type of the attribute
      Returns:
        an unknown attribute value

    - #### isPresent

          public boolean isPresent()

      Tells if this attribute value is present.
      Returns:
        true if this attribute value is present, implying not `null`.

    - #### get

          public T get()

      Returns the value of this attribute.
      Returns:
        the value of this attribute. Throws an error if called on a missing or unknown attribute value.

    - #### isUnknown

          public boolean isUnknown()

      Returns true if this attribute value is unknown.
      Returns:
        true if this attribute value is unknown.

    - #### isMissing

          public boolean isMissing()

      Returns true if this attribute value is missing.
      Returns:
        true if this attribute value is missing.

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`