public class SingletonModuleRegistry extends java.lang.Object implements ModuleRegistry
ModuleRegistry
suitable to lookup a module that is at
the root of the classpath. In a typical source-form project (such as Maven), the module definition files will reside
in src/main/resource/
(as in src/main/resources/config/foo.xml
) and as such will end up at the "root"
of the classpath at runtime, with no way for a "normal" registry to infer the module type (and possibly name).
This implementation is thus typically useful when writing tests for a module in the project that is defining that very same project.
Constructor and Description |
---|
SingletonModuleRegistry(ModuleType moduleType,
java.lang.String moduleName) |
SingletonModuleRegistry(ModuleType moduleType,
java.lang.String moduleName,
java.lang.String location) |
Modifier and Type | Method and Description |
---|---|
ModuleDefinition |
findDefinition(java.lang.String name,
ModuleType moduleType)
Lookup a module of the given type with the given name.
|
java.util.List<ModuleDefinition> |
findDefinitions()
Returns all module definitions.
|
java.util.List<ModuleDefinition> |
findDefinitions(ModuleType type)
Searches the registry for the type specified and returns all module definitions that match the type.
|
java.util.List<ModuleDefinition> |
findDefinitions(java.lang.String name)
Searches the registry for the name specified and returns all module definitions that match the name regardless of
module type.
|
public SingletonModuleRegistry(ModuleType moduleType, java.lang.String moduleName)
public SingletonModuleRegistry(ModuleType moduleType, java.lang.String moduleName, java.lang.String location)
public ModuleDefinition findDefinition(java.lang.String name, ModuleType moduleType)
ModuleRegistry
findDefinition
in interface ModuleRegistry
null
if this registry does not have such a modulepublic java.util.List<ModuleDefinition> findDefinitions(java.lang.String name)
ModuleRegistry
findDefinitions
in interface ModuleRegistry
name
- The module definition name to be searched.public java.util.List<ModuleDefinition> findDefinitions(ModuleType type)
ModuleRegistry
findDefinitions
in interface ModuleRegistry
type
- The module type name to be searched.public java.util.List<ModuleDefinition> findDefinitions()
ModuleRegistry
findDefinitions
in interface ModuleRegistry