public class ClasspathScannerImpl extends AbstractClasspathScanner
ClasspathScanner
.Modifier and Type | Class and Description |
---|---|
protected static class |
ClasspathScannerImpl.Cache
Container with all cached data.
|
Modifier and Type | Field and Description |
---|---|
private ClasspathScannerImpl.Cache |
cache |
private ReflectionUtil |
reflectionUtil |
Constructor and Description |
---|
ClasspathScannerImpl()
The constructor.
|
doInitialized, getInstance
createLogger, getLogger
getInitializationState, initialize
private ReflectionUtil reflectionUtil
private ClasspathScannerImpl.Cache cache
public ReflectionUtil getReflectionUtil()
ReflectionUtil
to use.@Inject public void setReflectionUtil(ReflectionUtil reflectionUtil)
reflectionUtil
- is the ReflectionUtil
to Inject
.protected void doInitialize()
AbstractComponent
initialization
. It is called when AbstractComponent.initialize()
is
invoked for the first time. super.
AbstractComponent.doInitialize()
.doInitialize
in class AbstractLoggableComponent
protected final ClasspathScannerImpl.Cache getCache()
ClasspathScannerImpl.Cache
. Will be created lazily.private void initCache()
root
.public void clearCaches()
ClasspathScanner
private ClasspathFolder createFolderRecursive(ResourcePathNode<Void> path, ClasspathFolder rootFolder)
path
- the path to create.rootFolder
- the root folder.public ClasspathFolder getClasspathResource()
BrowsableResource
for the root (or default) package.public BrowsableResource getClasspathResource(String classpath)
classpath
- is the classpath location pointing to a Package
or
ClasspathResource
.BrowsableResource
for the given classpath
.public BrowsableResource getClasspathResource(Package pkg)
pkg
- is the Package
to get.BrowsableResource
pointing to the given package.public Iterable<? extends BrowsableResource> getClasspathResourceFiles()
public Iterable<? extends BrowsableResource> getClasspathResourceFiles(Filter<? super BrowsableResource> filter)
filter
- decides which file resources
to accept
. Please note that the name
of the filtered resources will end
with ".class" in case of a Class
.Iterable
with all resource files
on the classpath
accepted
by the given filter
.public Iterable<Class<?>> getClasspathResourceClasses(Filter<String> classnameFilter, Filter<Class<?>> classFilter)
public String getQualifiedName(DataResource classResource) throws IllegalArgumentException
classResource
- a DataResource
that identifies a Java *.class
file or a Package
from your classpath. Should be retrieved from this ClasspathScanner
.class name
or package name
.
Will be null
in case the given DataResource
is not pointing to a Class
or
Package
.IllegalArgumentException
public <T> Class<T> loadClass(BrowsableResource classResource) throws IllegalArgumentException
T
- the generic type of the returned Class
for simplistic usage.classResource
- a BrowsableResource
that identifies a Java *.class file from your classpath. Should be
retrieved from this ClasspathScanner
.Class
.IllegalArgumentException
- if the given BrowsableResource
does not point to a *.class file.Copyright © 2001–2016 mmm-Team. All rights reserved.