br.com.objectos.git
Class MutableTree

java.lang.Object
  extended by br.com.objectos.git.MutableTree
All Implemented Interfaces:
br.com.objectos.core.object.ToStringObject

public final class MutableTree
extends Object

A class for creating a Git tree hierarchy suitable for recursively writing to a repository.

Since:
2

Constructor Summary
MutableTree()
          Creates an unnamed MutableTree instance.
MutableTree(String name)
          Creates a MutableTree instance having the specified name.
 
Method Summary
 void addEntry(Entry entry)
          Adds the specified entry to this mutable tree.
 void addEntry(MutableBlob blob)
          Adds the specified blob to this mutable tree.
 void addEntry(MutableTree tree)
          Adds the specified tree to this mutable tree.
 void clear()
          Removes all of the entries from this tree.
 void formatToString(StringBuilder sb, int depth)
           
 EntryMode getMode()
          Returns the file mode of this tree entry.
 String getName()
          Returns the name of this tree entry.
 boolean hasName(String name)
          Returns true if this tree entry has the specified name, false otherwise.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MutableTree

public MutableTree()
Creates an unnamed MutableTree instance.

Since:
3

MutableTree

public MutableTree(String name)
Creates a MutableTree instance having the specified name.

Parameters:
name - the name of this tree when serving as a tree entry
Throws:
IllegalArgumentException - if name is an empty string
Since:
3
Method Detail

addEntry

public final void addEntry(Entry entry)
Adds the specified entry to this mutable tree.

Parameters:
entry - the entry to be added

addEntry

public final void addEntry(MutableBlob blob)
Adds the specified blob to this mutable tree.

Parameters:
blob - the blob to be added

addEntry

public final void addEntry(MutableTree tree)
Adds the specified tree to this mutable tree.

Parameters:
tree - the tree to be added

clear

public final void clear()
Removes all of the entries from this tree.


formatToString

public final void formatToString(StringBuilder sb,
                                 int depth)

getMode

public final EntryMode getMode()
Returns the file mode of this tree entry.

Returns:
the file mode of this tree entry

getName

public final String getName()
Returns the name of this tree entry.

Returns:
the name of this tree entry

hasName

public final boolean hasName(String name)
Returns true if this tree entry has the specified name, false otherwise.

Parameters:
name - the value to test this entry's name against
Returns:
true if this tree entry has the specified name, false otherwise
Since:
3

toString

public final String toString()
Overrides:
toString in class Object


Copyright © 2020–2022 Objectos Software LTDA. All rights reserved.