org.exist.fluent
Class Folder.ChildrenFacet

java.lang.Object
  extended by org.exist.fluent.Folder.ChildrenFacet
All Implemented Interfaces:
Iterable<Folder>
Enclosing class:
Folder

public class Folder.ChildrenFacet
extends Object
implements Iterable<Folder>

The children (subfolders) facet of a collection. Permits operations on subfolders, both immediate and indirect.

Author:
Piotr Kaminski

Method Summary
 boolean contains(String descendantName)
          Return whether this folder has a descendant folder with the given name.
 Folder create(String descendantName)
          Get a descendant folder of this folder, or create it if it doesn't exist.
 void export(File destination)
          Export these children folders to the given directory.
 Folder get(String descendantName)
          Return an existing descendant this of this folder, inheriting this one's namespace mappings.
 Iterator<Folder> iterator()
          Return an iterator over the immediate child subfolders.
 int size()
          Return the number of immediate child folders of this folder.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

public Folder get(String descendantName)
Return an existing descendant this of this folder, inheriting this one's namespace mappings.

Parameters:
descendantName - the relative name of the child folder to get; must not start with '/'
Returns:
the descendant folder with the given name

create

public Folder create(String descendantName)
Get a descendant folder of this folder, or create it if it doesn't exist. It inherits this folder's namespace mappings.

Parameters:
descendantName - the relative name of the descendant folder to create; must not start with '/'
Returns:
the child folder with the given name

size

public int size()
Return the number of immediate child folders of this folder.

Returns:
the number of child subfolders

contains

public boolean contains(String descendantName)
Return whether this folder has a descendant folder with the given name.

Parameters:
descendantName - the relative name of the descendant folder; must not start with '/'
Returns:
true if this folder has a descendant wich the given name, false otherwise

export

public void export(File destination)
            throws IOException
Export these children folders to the given directory. If the directory does not exist it will be created. A subdirectory will be created for each child folder.

Parameters:
destination - the destination folder to export into
Throws:
IOException - if the export failed due to an I/O error

iterator

public Iterator<Folder> iterator()
Return an iterator over the immediate child subfolders. You can use this iterator to selectively delete subfolders as well.

Specified by:
iterator in interface Iterable<Folder>
Returns:
an iterator over the child subfolders


Copyright (C) All rights reserved.