public class FilesystemResourceLocator extends Object implements ResourceLocator
ResourceLocator that can locate resources in the filesystem. Instances of
FilesystemResourceLocator are explicitly created by the user and then bound to
a DI registry. E.g.:
class MyModule implements Module {
public void configure(Binder binder) {
File dir1 = ...
File dir2 = ...
binder.bind(ResourceLocator.class).
toInstance(new FilesystemResourceLocator(dir1, dir2);
}
| Constructor and Description |
|---|
FilesystemResourceLocator(Collection<File> roots)
Creates a new
FilesystemResourceLocator, using a collection of base
locations. |
FilesystemResourceLocator(File... roots)
Creates a new
FilesystemResourceLocator, using an array of base locations
("roots"). |
| Modifier and Type | Method and Description |
|---|---|
Collection<Resource> |
findResources(String name)
Finds a collection of matching resources for a given name.
|
protected File[] roots
public FilesystemResourceLocator(File... roots)
FilesystemResourceLocator, using an array of base locations
("roots"). If a location is a file, its parent directory is used for resolving. If
location is a directory, it is used as is. If no locations are specified, current
application directory is used as a single base.public FilesystemResourceLocator(Collection<File> roots)
FilesystemResourceLocator, using a collection of base
locations. If a location is a file, its parent directory is used for resolving. If
location is a directory, it is used as is. If no locations are specified, current
application directory is used as a single base.public Collection<Resource> findResources(String name)
ResourceLocatorfindResources in interface ResourceLocatorCopyright © 2001–2023 Apache Cayenne. All rights reserved.