org.pentaho.platform.api.repository2.unified
Class RepositoryFileTree

java.lang.Object
  extended by org.pentaho.platform.api.repository2.unified.RepositoryFileTree
All Implemented Interfaces:
Serializable, Comparable<RepositoryFileTree>

public class RepositoryFileTree
extends Object
implements Comparable<RepositoryFileTree>, Serializable

A struct for a RepositoryFile and its immediate children.* The immediate children is a list of this type (which can have children and so on). This class is immutable.

* This is necessary since a RepositoryFile does not (by design) have a reference to its children. A RepositoryFile is meant to be a lightweight object representing metadata about a file in isolation. It does not have references to other RepositoryFile instances. The potential for misuse of a children field on RepositoryFile was great enough to warrant the creation of RepositoryFileTree. This separation of single file vs. tree is seen as a cleaner API with less confusion about when children is populated.

Author:
mlowery
See Also:
Serialized Form

Constructor Summary
RepositoryFileTree(RepositoryFile file, List<RepositoryFileTree> children)
           
 
Method Summary
 int compareTo(RepositoryFileTree other)
          Compare is based on the root file.
 boolean equals(Object obj)
           
 List<RepositoryFileTree> getChildren()
          Children can be have one of three values: null: children were not fetched; used for operations that support depth empty list: there are no children for this file (i.e.
 RepositoryFile getFile()
           
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RepositoryFileTree

public RepositoryFileTree(RepositoryFile file,
                          List<RepositoryFileTree> children)
Method Detail

getFile

public RepositoryFile getFile()

getChildren

public List<RepositoryFileTree> getChildren()
Children can be have one of three values:

Returns:

compareTo

public int compareTo(RepositoryFileTree other)
Compare is based on the root file.

Specified by:
compareTo in interface Comparable<RepositoryFileTree>

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object