Package org.codehaus.groovy.runtime.m12n
Class ExtensionModuleRegistry
java.lang.Object
org.codehaus.groovy.runtime.m12n.ExtensionModuleRegistry
The extension method registry is responsible for collecting methods (or static methods) which are added to existing
classes and may be called like regular methods.
In previous Groovy versions, such methods could only be defined in a single class called DefaultGroovyMethods
for instance methods, and DefaultGroovyStaticMethods for static methods.
- Since:
- 2.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new ExtensionModuleRegistry with an empty module list. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddModule(ExtensionModule module) Adds an extension module to this registry.Retrieves a registered extension module by its name.Returns a copy of the list of all registered extension modules.booleanChecks if an extension module with the given name is registered.voidremoveModule(ExtensionModule module) Removes an extension module from this registry.
-
Constructor Details
-
ExtensionModuleRegistry
public ExtensionModuleRegistry()Constructs a new ExtensionModuleRegistry with an empty module list.
-
-
Method Details
-
addModule
Adds an extension module to this registry.- Parameters:
module- the extension module to add
-
removeModule
Removes an extension module from this registry.- Parameters:
module- the extension module to remove
-
getModules
Returns a copy of the list of all registered extension modules.- Returns:
- a list containing all registered extension modules
-
hasModule
Checks if an extension module with the given name is registered.- Parameters:
moduleName- the name of the module to check- Returns:
- true if a module with the given name is registered, false otherwise
-
getModule
Retrieves a registered extension module by its name.- Parameters:
moduleName- the name of the module to retrieve- Returns:
- the extension module with the given name, or null if not found
-