Package com.wavemaker.commons.io
Interface Resources<T extends Resource>
-
- All Superinterfaces:
java.lang.Iterable<T>
- All Known Implementing Classes:
AbstractResources,FilteredResources,ResourcesCollection
public interface Resources<T extends Resource> extends java.lang.Iterable<T>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Resources<T>copyTo(Folder folder)Recursively copy this resource to the specified folder.voiddelete()Delete the current resource (and any children).Resources<T>exclude(ResourceFilter... filters)Return a newResourcesinstance removing items that match any of the specified filters.java.util.List<T>fetchAll()Fetch allResources from this collection and return the result as aList.Resources<File>files()Resources<Folder>folders()Return a newResourcesinstance containing onlyFolderss from this collection.FoldergetSource()Returns the source of the resources.Resources<T>include(ResourceFilter... filters)Return a newResourcesinstance containing items that match any of the specified filters.Resources<T>moveTo(Folder folder)Move this resource to the specified folder.<O extends ResourceOperation<T>>
OperformOperation(O operation)Perform the given operation with eachResourcein this collection.
-
-
-
Method Detail
-
getSource
Folder getSource()
Returns the source of the resources. Items in this collection will bemovedorcopiedrelative to the source. For example, if this object contains the files '/a/b/c.txt' and '/d/e/f.txt' and the source is '/d' copy to '/x/ will result in '/x/b/c.txt' and 'x/e/f.txt'.- Returns:
- the source for the resources
-
folders
Resources<Folder> folders()
Return a newResourcesinstance containing onlyFolderss from this collection.- Returns:
- the folders
-
include
Resources<T> include(ResourceFilter... filters)
Return a newResourcesinstance containing items that match any of the specified filters.- Parameters:
filters- the include filters- Returns:
- filtered
Resources
-
exclude
Resources<T> exclude(ResourceFilter... filters)
Return a newResourcesinstance removing items that match any of the specified filters.- Parameters:
filters- the exclude filters- Returns:
- filtered
Resources
-
delete
void delete()
Delete the current resource (and any children). If this resource does not exist then no operation is performed.
-
moveTo
Resources<T> moveTo(Folder folder)
Move this resource to the specified folder. Any duplicateFiles will be replaced (existingFolderresources will be merged). If the resource does not exist no operation is performed.- Parameters:
folder- the folder to move the resource to- Returns:
- a resource collection containing the new destination resources
- Throws:
ResourceDoesNotExistException- if this resource no longer exists
-
copyTo
Resources<T> copyTo(Folder folder)
Recursively copy this resource to the specified folder. Any duplicateFiles will be replaced (existingFolderresources will be merged). If the resource does not exist no operation is performed.- Parameters:
folder- the folder to copy the resource to- Returns:
- a resource collection containing the new destination resources
- Throws:
ResourceDoesNotExistException- if this resource no longer exists
-
performOperation
<O extends ResourceOperation<T>> O performOperation(O operation)
Perform the given operation with eachResourcein this collection.- Parameters:
operation- the operation to perform- Returns:
- the operation that was performed
-
-