Package org.opt4j.config
Class ModuleAutoFinder
java.lang.Object
org.opt4j.config.ModuleAutoFinder
- All Implemented Interfaces:
ModuleList
The
ModuleAutoFinder
searches the classpath for all
PropertyModule
s that are not annotated with Ignore
.-
Field Summary
Modifier and TypeFieldDescriptionprotected final org.apache.commons.collections15.Transformer<Class<? extends com.google.inject.Module>,
Boolean> protected ClassLoader
protected final Collection<String>
protected final org.apache.commons.collections15.Transformer<Class<? extends com.google.inject.Module>,
Boolean> protected final Set<ModuleAutoFinderListener>
-
Constructor Summary
ConstructorDescriptionConstructs aModuleAutoFinder
.ModuleAutoFinder
(org.apache.commons.collections15.Transformer<Class<? extends com.google.inject.Module>, Boolean> accept, org.apache.commons.collections15.Transformer<Class<? extends com.google.inject.Module>, Boolean> ignore, Collection<String> directories) Constructs aModuleAutoFinder
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(ModuleAutoFinderListener listener) Add aModuleAutoFinderListener
.protected Collection<Class<? extends com.google.inject.Module>>
getAll()
Returns all not abstract classes that implementPropertyModule
.getAllClasses
(File directory) Retrieves all Classes from onedirectory
.getAllClasses
(File root, File file) Recursive methods searching for classes in a root directory.getAllClasses
(ZipFile zipFile) Retrieves all Classes from aZipFile
(Jar archive).Collection<Class<? extends com.google.inject.Module>>
Returns the classes of all modules.protected void
Invoke an err message for theModuleAutoFinderListener
.protected void
Invoke an out message for theModuleAutoFinderListener
.protected boolean
Returnstrue
if the file is a Jar archive.void
removeListener
(ModuleAutoFinderListener listener) Remove aModuleAutoFinderListener
.
-
Field Details
-
accept
-
ignore
-
listeners
-
directories
-
classLoader
-
-
Constructor Details
-
ModuleAutoFinder
@Inject public ModuleAutoFinder()Constructs aModuleAutoFinder
. -
ModuleAutoFinder
public ModuleAutoFinder(org.apache.commons.collections15.Transformer<Class<? extends com.google.inject.Module>, Boolean> accept, org.apache.commons.collections15.Transformer<Class<? extends com.google.inject.Module>, Boolean> ignore, Collection<String> directories) Constructs aModuleAutoFinder
.- Parameters:
accept
- the accept transformerignore
- the ignore transformerdirectories
- additional directories for the classpath
-
-
Method Details
-
getModules
Description copied from interface:ModuleList
Returns the classes of all modules.- Specified by:
getModules
in interfaceModuleList
- Returns:
- the classes of all modules
-
getAll
Returns all not abstract classes that implementPropertyModule
.- Returns:
- all property modules
-
isJar
Returnstrue
if the file is a Jar archive.- Parameters:
file
- the tested file- Returns:
true
if the file is a Jar archive
-
getAllClasses
Retrieves all Classes from onedirectory
.- Parameters:
directory
- the directory- Returns:
- all classes in a list
-
getAllClasses
Recursive methods searching for classes in a root directory.- Parameters:
root
- the root directoryfile
- the current file- Returns:
- the list of all found classes
-
getAllClasses
Retrieves all Classes from aZipFile
(Jar archive).- Parameters:
zipFile
- the Jar archive- Returns:
- the list of all classes
-
invokeOut
Invoke an out message for theModuleAutoFinderListener
.- Parameters:
message
- the message
-
invokeErr
Invoke an err message for theModuleAutoFinderListener
.- Parameters:
message
- the message
-
addListener
Add aModuleAutoFinderListener
.- Parameters:
listener
- the listener to be added
-
removeListener
Remove aModuleAutoFinderListener
.- Parameters:
listener
- the listener to be removed- See Also:
-