public interface ExtensionContainer
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.String name,
java.lang.Object extension)
Adding an extension of name 'foo' will:
add 'foo' dynamic property
add 'foo' dynamic method that accepts a closure that is a configuration script block
|
<T> void |
configure(java.lang.Class<T> type,
Action<? super T> action)
Looks for the extension of the specified type and configures it with the supplied action.
|
<T> T |
create(java.lang.String name,
java.lang.Class<T> type,
java.lang.Object... constructionArguments)
Adds a new extension to this container, that itself is dynamically made
ExtensionAware . |
java.lang.Object |
findByName(java.lang.String name)
Looks for the extension of a given name.
|
<T> T |
findByType(java.lang.Class<T> type)
Looks for the extension of a given type (useful to avoid casting).
|
java.lang.Object |
getByName(java.lang.String name)
Looks for the extension of a given name.
|
<T> T |
getByType(java.lang.Class<T> type)
Looks for the extension of a given type (useful to avoid casting).
|
ExtraPropertiesExtension |
getExtraProperties()
The extra properties extension in this extension container.
|
void add(java.lang.String name, java.lang.Object extension)
name
- Will be used as a sort of namespace of properties/methods.extension
- Any object whose methods and properties will extend the target objectjava.lang.IllegalArgumentException
- When an extension with the given name already exists.<T> T create(java.lang.String name, java.lang.Class<T> type, java.lang.Object... constructionArguments)
ExtensionAware
.
A new instance of the given type
will be created using the given constructionArguments
. The new
instance will have been dynamically which means that you can cast the object to ExtensionAware
.name
- The name for the extensiontype
- The type of the extensionconstructionArguments
- The arguments to be used to construct the extension instancejava.lang.IllegalArgumentException
- When an extension with the given name already exists.add(String, Object)
<T> T getByType(java.lang.Class<T> type) throws UnknownDomainObjectException
type
- extension typeUnknownDomainObjectException
- When the given extension is not found.<T> T findByType(java.lang.Class<T> type)
type
- extension typejava.lang.Object getByName(java.lang.String name) throws UnknownDomainObjectException
name
- extension nameUnknownDomainObjectException
- When the given extension is not found.java.lang.Object findByName(java.lang.String name)
name
- extension name@Incubating <T> void configure(java.lang.Class<T> type, Action<? super T> action)
type
- extension typeaction
- the configure actionUnknownDomainObjectException
- if no extension is found.ExtraPropertiesExtension getExtraProperties()