Package org.eclipse.jgit.attributes
Class Attribute
- java.lang.Object
-
- org.eclipse.jgit.attributes.Attribute
-
public final class Attribute extends java.lang.ObjectRepresents 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 - used to revert an attribute . This is crucial in order to mark an attribute as unspecified in the attributes map and thus preventing following (with lower priority) nodes from setting the attribute to a value at all
- Since:
- 3.7
- Set - represented by
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAttribute.StateThe attribute value state see also https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringkeyprivate Attribute.Statestateprivate java.lang.Stringvalue
-
Constructor Summary
Constructors Modifier Constructor Description Attribute(java.lang.String key, java.lang.String value)Creates a new instance.Attribute(java.lang.String key, Attribute.State state)Creates a new instanceprivateAttribute(java.lang.String key, Attribute.State state, java.lang.String value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)java.lang.StringgetKey()Get keyAttribute.StategetState()Return the state.java.lang.StringgetValue()Get valueinthashCode()java.lang.StringtoString()
-
-
-
Field Detail
-
key
private final java.lang.String key
-
state
private final Attribute.State state
-
value
private final java.lang.String value
-
-
Constructor Detail
-
Attribute
public Attribute(java.lang.String key, Attribute.State state)Creates a new instance- Parameters:
key- the attribute key. Should not benull.state- the attribute state. It should be eitherAttribute.State.SETorAttribute.State.UNSET. In order to create a custom value attribute prefer the use ofAttribute(String, String)constructor.
-
Attribute
private Attribute(java.lang.String key, Attribute.State state, java.lang.String value)
-
Attribute
public Attribute(java.lang.String key, java.lang.String value)Creates a new instance.- Parameters:
key- the attribute key. Should not benull.value- the custom attribute value
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
getKey
public java.lang.String getKey()
Get key- Returns:
- the attribute key (never returns
null)
-
getState
public Attribute.State getState()
Return the state.- Returns:
- the state (never returns
null)
-
getValue
public java.lang.String getValue()
Get value- Returns:
- the attribute value (may be
null)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-