class ClasspathFolder extends AbstractBrowsableClasspathResource
| Modifier and Type | Field and Description |
|---|---|
(package private) List<AbstractBrowsableClasspathResource> |
children |
nameHOME_PATH_CHAR, PATH_SEGMENT_CURRENT_DIRECTORY, PATH_SEGMENT_PARENT_DIRECTORY, PATH_SEGMENT_SEPARATOR, PATH_SEGMENT_SEPARATOR_CHAR, UNC_PATH_PREFIX, URL_SCHEME_AUTHORITY_SEPARATOR| Constructor and Description |
|---|
ClasspathFolder(ClasspathFolder parent,
String name)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
BrowsableResource |
cd(String path)
|
(package private) AbstractBrowsableClasspathResource |
getChildResource(String childName) |
Iterable<? extends AbstractBrowsableClasspathResource> |
getChildResources()
This method iterates the immediate child-
resources contained in this
BrowsableResource. |
(package private) ClasspathFolder |
getOrCreateChildFolder(String childName) |
URL |
getUrl()
This method gets this resource as
URL. |
protected void |
init()
Initializes this resource after it has been properly completed.
|
boolean |
isData()
This method determines if this resource has potentially data
available. |
boolean |
isFolder()
This method determines if this
BrowsableResource is a folder that potentially contains other
resources. |
(package private) AbstractBrowsableClasspathResource |
navigate(ResourcePathNode<Void> path,
boolean create) |
DataResource |
navigate(String resourcePath)
This method retrieves a
DataResource pointing to the given resourcePath based on this resource.E.g. |
(package private) DataResource |
navigate(String resourcePath,
boolean returnNullIfNotExists) |
getLastModificationDate, getName, getParent, getPath, getPath, getQualifiedName, getRoot, getSchemePrefix, getUri, isAbsolute, isRootgetChildResourcesequals, getSize, hashCode, isAvailable, isModifiedSince, openOutputStream, openStream, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetSize, isAvailable, isModifiedSince, openOutputStream, openStreamList<AbstractBrowsableClasspathResource> children
ClasspathFolder(ClasspathFolder parent, String name)
parent - - see AbstractBrowsableClasspathResource.getParent().name - - see AbstractBrowsableClasspathResource.getName().protected void init()
init in class AbstractBrowsableClasspathResourceAbstractBrowsableClasspathResource getChildResource(String childName)
childName - is the name of the requested child resource.child folder or a new one created and added otherwise.ClasspathFolder getOrCreateChildFolder(String childName)
childName - is the name of the requested child resource.child folder or a new one created and added otherwise.public Iterable<? extends AbstractBrowsableClasspathResource> getChildResources()
BrowsableResourceresources contained in this
BrowsableResource. folder, this method will always return an empty Iterable.getChildResources in interface BrowsableResourcegetChildResources in class AbstractBrowsableClasspathResourceIterable of the child-resources.public boolean isFolder()
BrowsableResourceBrowsableResource is a folder that potentially contains other
resources. Otherwise if this is no folder, BrowsableResource.getChildResources() will be empty
(return an empty Iterable). However BrowsableResource.getChildResources() can also be empty, if this is a folder.
BrowsableResource is containing data, please use
DataResource.isAvailable(). Please note that BrowsableResource.isFolder() and DataResource.isAvailable() can both return
true or both return false.true if this is a folder, false otherwise.public boolean isData()
DataResourceavailable. Unlike
DataResource.isAvailable() this method will not invoke expensive operations like connecting to remote URLs. If this
method will return false, then DataResource.isAvailable() would also have returned false. However in
case of true only DataResource.isAvailable() can guarantee if a resource really exists and contains data. E.g.
if the resource points to a File then this method can check if it is a data-file. So in case it points to a directory or does not exist at all in the filesystem, this method will return
false. Please also note that this may invoke expensive operations if the according directory path points to
something like a network share. You should also be aware that the state of DataResource.isData() and
DataResource.isAvailable() can change at any time so you never have a full guarantee if some data exists or NOT.
However in most cases it is very improbable that this status changes when you read the
resource immediately after the check.true if this resource points to potential data, false otherwise.public URL getUrl() throws ResourceNotAvailableException
DataResourceURL.ResourceNotAvailableException - if an URL can NOT be created because the represented resource does not exist.AbstractBrowsableClasspathResource navigate(ResourcePathNode<Void> path, boolean create)
path - the ResourcePathNode.create - - true if non existing ressources should be created as fake resources, false
oterhwise.AbstractBrowsableClasspathResource. May be null if the given path does not
exist and create is false.navigate(String)public DataResource navigate(String resourcePath) throws ResourceUriUndefinedException
DataResourceDataResource pointing to the given resourcePath based on this resource.resourcePath would be "../apt/sources.list"
the resulting resource would point to "/etc/apt/sources.list". folder of this resource. This will also be the case if this resource itself is
a folder. Due to this generic API this is the only consistent way as there are
implementations that can not easily know if they represent a folder or a
file or maybe even both at the same time. However, please be aware of this and
do not get confused as you might expect this to be a cd command if invoked on
a folder what is not exactly not the case (instead it is a
cd on the parent folder). On a BrowsableResource you can use
BrowsableResource.cd(String) instead to avoid confusion.navigate in interface DataResourcenavigate in class AbstractBrowsableClasspathResourceresourcePath - the absolute or relative path pointing to a new resource. If it is a relative path, it is
interpreted relative to the parent URI (directory) of this resource.ResourceUriUndefinedException - if the given resourcePath leads to an undefined or illegal URI.BrowsableResource.cd(String)public BrowsableResource cd(String path)
BrowsableResourcepath - the absolute or relative path pointing to a new resource. If it is a relative path, it is interpreted
relative to the current URI (directory) if this is a folder and relative to the parent
URI otherwise.DataResource.navigate(String)DataResource navigate(String resourcePath, boolean returnNullIfNotExists)
resourcePath - the path to navigate to.returnNullIfNotExists - - if true then null is returned for non-existent resources, otherwise
a ClasspathResource is created and returned.DataResource.#navigate(ResourcePathNode)Copyright © 2001–2016 mmm-Team. All rights reserved.