Package org.eclipse.jgit.attributes
Class Attributes
- java.lang.Object
-
- org.eclipse.jgit.attributes.Attributes
-
public final class Attributes extends Object
Represents a set of attributes for a path- Since:
- 4.2
-
-
Constructor Summary
Constructors Constructor Description Attributes(Attribute... attributes)
Creates a new instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canBeContentMerged()
Test if the given attributes implies to handle the related entry as a binary file (i.e.boolean
containsKey(String key)
Whether there is an attribute with this keyboolean
equals(Object obj)
Attribute
get(String key)
Get the attribute with the given keyCollection<Attribute>
getAll()
Get all attributesAttribute.State
getState(String key)
Return the state.String
getValue(String key)
Get attribute valueint
hashCode()
boolean
isCustom(String key)
Is this a custom attributeboolean
isEmpty()
Whether the set of attributes is emptyboolean
isSet(String key)
Whether the attribute is setboolean
isUnset(String key)
Whether the attribute is unsetboolean
isUnspecified(String key)
Whether the attribute with the given key is unspecifiedvoid
put(Attribute a)
Put an attributevoid
remove(String key)
Remove attribute with given keyString
toString()
-
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
Whether the set of attributes is empty- Returns:
- true if the set does not contain any attributes
-
get
public Attribute get(String key)
Get the attribute with the given key- Parameters:
key
- aString
object.- Returns:
- the attribute or null
-
getAll
public Collection<Attribute> getAll()
Get all attributes- Returns:
- all attributes
-
remove
public void remove(String key)
Remove attribute with given key- Parameters:
key
- an attribute name
-
containsKey
public boolean containsKey(String key)
Whether there is an attribute with this key- Parameters:
key
- key of an attribute- Returns:
- true if the
Attributes
contains this key
-
getState
public Attribute.State getState(String key)
Return the state.- Parameters:
key
- key of an attribute- Returns:
- the state (never returns
null
)
-
isSet
public boolean isSet(String key)
Whether the attribute is set- Parameters:
key
- aString
object.- Returns:
- true if the key is
Attribute.State.SET
, false in all other cases
-
isUnset
public boolean isUnset(String key)
Whether the attribute is unset- Parameters:
key
- aString
object.- Returns:
- true if the key is
Attribute.State.UNSET
, false in all other cases
-
isUnspecified
public boolean isUnspecified(String key)
Whether the attribute with the given key is unspecified- Parameters:
key
- aString
object.- Returns:
- true if the key is
Attribute.State.UNSPECIFIED
, false in all other cases
-
isCustom
public boolean isCustom(String key)
Is this a custom attribute- Parameters:
key
- aString
object.- Returns:
- true if the key is
Attribute.State.CUSTOM
, false in all other cases seegetValue(String)
for the value of the key
-
getValue
public String getValue(String key)
Get attribute value- Parameters:
key
- an attribute key- Returns:
- the attribute value (may be
null
)
-
canBeContentMerged
public boolean canBeContentMerged()
Test if the given attributes implies to handle the related entry as a binary file (i.e. if the entry has an -merge or a merge=binary attribute) or if it can be content merged.- Returns:
true
if the entry can be content merged,false
otherwise- Since:
- 4.9
-
-