Top Description Fields Constructors Methods
org.codehaus.commons.compiler.util.resource

public Class MultiResourceFinder

extends ListableResourceFinder
Class Inheritance
Known Direct Subclasses
org.codehaus.commons.compiler.util.resource.LazyMultiResourceFinder
Imports
java.io.IOException, java.util.ArrayList, .Arrays, .List, org.codehaus.commons.nullanalysis.Nullable

A org.codehaus.commons.compiler.util.resource.ResourceFinder that finds its resources through a collection of other org.codehaus.commons.compiler.util.resource.ResourceFinders.

Field Summary

Modifier and TypeField and Description
private final Iterable<? extends ResourceFinder>

Constructor Summary

AccessConstructor and Description
public
MultiResourceFinder(Iterable<? extends ResourceFinder>
The entries of the "path"
resourceFinders
)

public
MultiResourceFinder(ResourceFinder...
The entries of the "path"
resourceFinders
)

Method Summary

Modifier and TypeMethod and Description
public final Resource
findResource(String
Designates the resource; typically structured by slashes ("/") like "com/foo/pkg/Bar.class"
resourceName
)

Implements abstract org.codehaus.commons.compiler.util.resource.ResourceFinder.findResource.

Finds a resource by name and return it as a Resource object.
public Iterable<Resource>
list(String
E.g. "" or "java/lang/"
resourceNamePrefix
,
boolean recurse)

Implements abstract org.codehaus.commons.compiler.util.resource.ListableResourceFinder.list.

Returns all resources who's names start with a given string.

Field Detail

resourceFindersback to summary
private final Iterable<? extends ResourceFinder> resourceFinders

Constructor Detail

MultiResourceFinderback to summary
public MultiResourceFinder(Iterable<? extends ResourceFinder> resourceFinders)
Parameters
resourceFinders:Iterable<? extends ResourceFinder>

The entries of the "path"

MultiResourceFinderback to summary
public MultiResourceFinder(ResourceFinder... resourceFinders)
Parameters
resourceFinders:ResourceFinder[]

The entries of the "path"

Method Detail

findResourceback to summary
public final Resource findResource(String resourceName)

Implements abstract org.codehaus.commons.compiler.util.resource.ResourceFinder.findResource.

Doc from org.codehaus.commons.compiler.util.resource.ResourceFinder.findResource.

Finds a resource by name and return it as a Resource object.

Parameters
resourceName:String

Designates the resource; typically structured by slashes ("/") like "com/foo/pkg/Bar.class"

Returns:Resource

null if the resource could not be found

Annotations
@Override
@Nullable
listback to summary
public Iterable<Resource> list(String resourceNamePrefix, boolean recurse) throws IOException

Implements abstract org.codehaus.commons.compiler.util.resource.ListableResourceFinder.list.

Doc from org.codehaus.commons.compiler.util.resource.ListableResourceFinder.list.

Returns all resources who's names start with a given string. Only resources with a content are included, no "special entries" of any kind, e.g. directories.

If the prefix string ends with "/", you will get a proper directory listing (recurse=false) or directory tree (recurse=true). Example:

  resourceFinder.list("dir/", true) =>
    dir/
    dir/afile
    dir/bfile
    dir/adir/
    dir/adir/file
    dir/bdir/
    dir/bdir/file

Otherwise, you will get a strange subset of a directory listing, resp. directory tree, as follows:

  resourceFinder.list("dir/a", true) =>
    dir/afile
    dir/adir/
    dir/adir/file
Parameters
resourceNamePrefix:String

E.g. "" or "java/lang/"

Returns:Iterable<Resource>

All resources who's name starts with the given prefix; null iff a location designated by the resourceNamePrefix does not exist

Annotations
@Override
@Nullable