org.pentaho.platform.api.repository2.unified
Class RepositoryFileTree
java.lang.Object
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
RepositoryFileTree
public RepositoryFileTree(RepositoryFile file,
List<RepositoryFileTree> children)
getFile
public RepositoryFile getFile()
getChildren
public 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. file is not a folder or folder has no children)
- non-empty list: this file is a folder and it has children
- 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