Constructor and Description |
---|
ModuleManager() |
Modifier and Type | Method and Description |
---|---|
<T extends Factory> |
getFactory(Function<Module,Optional<T>> selector)
Returns the first factory found in the loaded modules given a selector.
|
Optional<FunctionDefinition> |
getFunctionDefinition(String name)
Get an optional of
FunctionDefinition by a given name. |
List<ModuleEntry> |
listFullModules()
Get all loaded modules with use status.
|
Set<String> |
listFunctions()
Get names of all functions from used modules.
|
List<String> |
listModules()
Get names of all used modules in resolution order.
|
void |
loadModule(String name,
Module module)
Load a module under a unique name.
|
void |
unloadModule(String name)
Unload a module with given name.
|
void |
useModules(String... names)
Enable modules in use with declared name order.
|
public void loadModule(String name, Module module)
name
- name of the modulemodule
- the module instanceValidationException
- when there already exists a module with the same namepublic void unloadModule(String name)
name
- name of the moduleValidationException
- when there is no module with the given namepublic void useModules(String... names)
names
- module names to be usedValidationException
- when module names contain an unloaded namepublic List<String> listModules()
public List<ModuleEntry> listFullModules()
public Set<String> listFunctions()
public Optional<FunctionDefinition> getFunctionDefinition(String name)
FunctionDefinition
by a given name. Function will be resolved to
modules in the used order, and the first match will be returned. If no match is found in all
modules, return an optional.
It includes hidden functions even though not listed in listFunctions()
.
name
- name of the functionFunctionDefinition
public <T extends Factory> Optional<T> getFactory(Function<Module,Optional<T>> selector)
Modules are checked in the order in which they have been loaded. The first factory
returned by a module will be used. If no loaded module provides a factory, Optional.empty()
is returned.
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.