org.eclipse.jgit.attributes

## Class Attribute

- java.lang.Object
- - org.eclipse.jgit.attributes.Attribute

    public final class Attribute
    extends Object

Represents an attribute.

According to the man page, an attribute can have the following states:

- Set - represented by `Attribute.State.SET`
- Unset - represented by `Attribute.State.UNSET`
- Set to a value - represented by `Attribute.State.CUSTOM`
- Unspecified - `null` is used instead of an instance of this class

Since:
  3.7

### Nested Class Summary

Nested Classes
`static class` `Attribute.State` The attribute value state

### Constructor Summary

Constructors
Constructor and Description
`Attribute(String key, Attribute.State state)` Creates a new instance
`Attribute(String key, String value)` Creates a new instance.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `equals(Object obj)`
`String` `getKey()`
`Attribute.State` `getState()` Returns the state.
`String` `getValue()`
`int` `hashCode()`
`String` `toString()`

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

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

### Constructor Detail

#### Attribute

    public Attribute(String key,
                     Attribute.State state)

Creates a new instance

Parameters:
  `key` - the attribute key. Should not be `null`.
  `state` - the attribute state. It should be either `Attribute.State.SET` or `Attribute.State.UNSET`. In order to create a custom value attribute prefer the use of `Attribute(String, String)` constructor.

#### Attribute

    public Attribute(String key,
                     String value)

Creates a new instance.

Parameters:
  `key` - the attribute key. Should not be `null`.
  `value` - the custom attribute value

### Method Detail

#### equals

    public boolean equals(Object obj)

Overrides:
  `equals` in class `Object`

#### getKey

    public String getKey()

Returns:
  the attribute key (never returns `null`)

#### getState

    public Attribute.State getState()

Returns the state.

Returns:
  the state (never returns `null`)

#### getValue

    public String getValue()

Returns:
  the attribute value (may be `null`)

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`