public class Tree extends Item
Item that also contains it's children.| Modifier and Type | Field and Description |
|---|---|
protected List<Item> |
children
The folder's children.
|
descriptorDom, descriptorUrl, isFolder, name, properties, urlcachingTime, key, scope| Constructor and Description |
|---|
Tree()
Default no-arg constructor.
|
Tree(Item item)
Copy constructor that takes an item and calls the
Item.Item(Item). |
Tree(Item item,
boolean deepCopy)
Copy constructor that takes an item and calls the
Item.Item(Item, boolean). |
Tree(Tree tree)
Copy constructor that takes another tree.
|
Tree(Tree tree,
boolean deepCopy)
Copy constructor that takes another tree.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChild(Item child)
Adds a child.
|
boolean |
equals(Object o)
Returns true if
Item.equals(Object) returns true and if the specified Tree's and this instance's
children are equal. |
List<Item> |
getChildren()
Returns the tree's children.
|
int |
hashCode()
Returns the hash code, which is a combination of
Item.hashCode() and the list of children's hash code. |
boolean |
removeChild(Item child)
Removes a child.
|
void |
setChildren(List<Item> children)
Sets the tree's children.
|
void |
setFolder(boolean folder)
Overrides
Item.setFolder(boolean), by checking that the flag is never set to false, since a tree
is always a folder. |
String |
toString() |
getDescriptorDom, getDescriptorUrl, getName, getProperties, getProperty, getUrl, isFolder, queryDescriptorValue, queryDescriptorValues, setDescriptorDom, setDescriptorUrl, setName, setProperties, setProperty, setUrlgetCachingTime, getKey, getScope, setCachingTime, setKey, setScopepublic Tree()
folder to true, since a tree is always a folder.public Tree(Item item)
Item.Item(Item). Sets folder to true,
since a tree is always a folder.public Tree(Item item, boolean deepCopy)
Item.Item(Item, boolean). Sets folder to true,
since a tree is always a folder.public Tree(Tree tree)
Item.Item(Item, boolean) with
true).public Tree(Tree tree, boolean deepCopy)
deepCopy
flag. In a deep copy, a deep copy of each child is done (by calling Item.Item(Item, boolean) and
Tree(Tree, boolean)).public void setFolder(boolean folder)
Item.setFolder(boolean), by checking that the flag is never set to false, since a tree
is always a folder.setFolder in class ItemIllegalArgumentException - if the method was called with false (the folder flag should never being set
to false).public void addChild(Item child)
public boolean removeChild(Item child)
public boolean equals(Object o)
Item.equals(Object) returns true and if the specified Tree's and this instance's
children are equal.public int hashCode()
Item.hashCode() and the list of children's hash code.Copyright © 2018 CrafterCMS. All rights reserved.