Class AttributesNode


  • public class AttributesNode
    extends java.lang.Object
    Represents a bundle of attributes inherited from a base directory. This class is not thread safe, it maintains state about the last match.
    Since:
    3.7
    • Constructor Summary

      Constructors 
      Constructor Description
      AttributesNode()
      Create an empty ignore node with no rules.
      AttributesNode​(java.util.List<AttributesRule> rules)
      Create an ignore node with given rules.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void getAttributes​(java.lang.String entryPath, boolean isDirectory, java.util.Map<java.lang.String,​Attribute> attributes)
      Returns the matching attributes for an entry path.
      java.util.List<AttributesRule> getRules()  
      void parse​(java.io.InputStream in)
      Parse files according to gitattribute standards.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AttributesNode

        public AttributesNode()
        Create an empty ignore node with no rules.
      • AttributesNode

        public AttributesNode​(java.util.List<AttributesRule> rules)
        Create an ignore node with given rules.
        Parameters:
        rules - list of rules.
    • Method Detail

      • parse

        public void parse​(java.io.InputStream in)
                   throws java.io.IOException
        Parse files according to gitattribute standards.
        Parameters:
        in - input stream holding the standard ignore format. The caller is responsible for closing the stream.
        Throws:
        java.io.IOException - Error thrown when reading an ignore file.
      • getRules

        public java.util.List<AttributesRule> getRules()
        Returns:
        list of all ignore rules held by this node.
      • getAttributes

        public void getAttributes​(java.lang.String entryPath,
                                  boolean isDirectory,
                                  java.util.Map<java.lang.String,​Attribute> attributes)
        Returns the matching attributes for an entry path.
        Parameters:
        entryPath - the path to test. The path must be relative to this attribute node's own repository path, and in repository path format (uses '/' and not '\').
        isDirectory - true if the target item is a directory.
        attributes - Map that will hold the attributes matching this entry path. If it is not empty, this method will NOT override any existing entry.