Class Attributes


  • public final class Attributes
    extends java.lang.Object
    Represents a set of attributes for a path
    Since:
    4.2
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.String,​Attribute> map  
    • 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​(java.lang.String key)
      Whether there is an attribute with this key
      boolean equals​(java.lang.Object obj)
      Attribute get​(java.lang.String key)
      Get the attribute with the given key
      java.util.Collection<Attribute> getAll()
      Get all attributes
      Attribute.State getState​(java.lang.String key)
      Return the state.
      java.lang.String getValue​(java.lang.String key)
      Get attribute value
      int hashCode()
      boolean isCustom​(java.lang.String key)
      Is this a custom attribute
      boolean isEmpty()
      Whether the set of attributes is empty
      boolean isSet​(java.lang.String key)
      Whether the attribute is set
      boolean isUnset​(java.lang.String key)
      Whether the attribute is unset
      boolean isUnspecified​(java.lang.String key)
      Whether the attribute with the given key is unspecified
      void put​(Attribute a)
      Put an attribute
      void remove​(java.lang.String key)
      Remove attribute with given key
      java.lang.String toString()
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • map

        private final java.util.Map<java.lang.String,​Attribute> map
    • Constructor Detail

      • Attributes

        public Attributes​(Attribute... attributes)
        Creates a new instance
        Parameters:
        attributes - a Attribute
    • 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​(java.lang.String key)
        Get the attribute with the given key
        Parameters:
        key - a String object.
        Returns:
        the attribute or null
      • getAll

        public java.util.Collection<Attribute> getAll()
        Get all attributes
        Returns:
        all attributes
      • remove

        public void remove​(java.lang.String key)
        Remove attribute with given key
        Parameters:
        key - an attribute name
      • containsKey

        public boolean containsKey​(java.lang.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​(java.lang.String key)
        Return the state.
        Parameters:
        key - key of an attribute
        Returns:
        the state (never returns null)
      • isSet

        public boolean isSet​(java.lang.String key)
        Whether the attribute is set
        Parameters:
        key - a String object.
        Returns:
        true if the key is Attribute.State.SET, false in all other cases
      • isUnset

        public boolean isUnset​(java.lang.String key)
        Whether the attribute is unset
        Parameters:
        key - a String object.
        Returns:
        true if the key is Attribute.State.UNSET, false in all other cases
      • isUnspecified

        public boolean isUnspecified​(java.lang.String key)
        Whether the attribute with the given key is unspecified
        Parameters:
        key - a String object.
        Returns:
        true if the key is Attribute.State.UNSPECIFIED, false in all other cases
      • isCustom

        public boolean isCustom​(java.lang.String key)
        Is this a custom attribute
        Parameters:
        key - a String object.
        Returns:
        true if the key is Attribute.State.CUSTOM, false in all other cases see getValue(String) for the value of the key
      • getValue

        public java.lang.String getValue​(java.lang.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
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object