Class DirCacheEditor.PathEdit

  • Direct Known Subclasses:
    DirCacheEditor.DeletePath, DirCacheEditor.DeleteTree
    Enclosing class:
    DirCacheEditor

    public abstract static class DirCacheEditor.PathEdit
    extends java.lang.Object
    Any index record update.

    Applications should subclass and provide their own implementation for the apply(DirCacheEntry) method. The editor will invoke apply once for each record in the index which matches the path name. If there are multiple records (for example in stages 1, 2 and 3), the edit instance will be called multiple times, once for each stage.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) byte[] path  
      (package private) boolean replace  
    • Constructor Summary

      Constructors 
      Constructor Description
      PathEdit​(byte[] path)  
      PathEdit​(java.lang.String entryPath)
      Create a new update command by path name.
      PathEdit​(DirCacheEntry ent)
      Create a new update command for an existing entry instance.
    • Field Detail

      • path

        final byte[] path
      • replace

        boolean replace
    • Constructor Detail

      • PathEdit

        public PathEdit​(java.lang.String entryPath)
        Create a new update command by path name.
        Parameters:
        entryPath - path of the file within the repository.
      • PathEdit

        PathEdit​(byte[] path)
      • PathEdit

        public PathEdit​(DirCacheEntry ent)
        Create a new update command for an existing entry instance.
        Parameters:
        ent - entry instance to match path of. Only the path of this entry is actually considered during command evaluation.
    • Method Detail

      • setReplace

        public DirCacheEditor.PathEdit setReplace​(boolean ok)
        Configure if a file can replace a directory (or vice versa).

        Default is true as this is usually the desired behavior.

        Parameters:
        ok - if true a file can replace a directory, or a directory can replace a file.
        Returns:
        this
        Since:
        4.2
      • apply

        public abstract void apply​(DirCacheEntry ent)
        Apply the update to a single cache entry matching the path.

        After apply is invoked the entry is added to the output table, and will be included in the new index.

        Parameters:
        ent - the entry being processed. All fields are zeroed out if the path is a new path in the index.
      • toString

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