public interface ExtensionContainer
Modifier and Type | Method and Description |
---|---|
<T> void |
add(Class<T> publicType,
String name,
T extension)
Adds a new extension to this container.
|
void |
add(String name,
Object extension)
Adds a new extension to this container.
|
<T> void |
add(TypeOf<T> publicType,
String name,
T extension)
Adds a new extension to this container.
|
<T> void |
configure(Class<T> type,
Action<? super T> action)
Looks for the extension of the specified type and configures it with the supplied action.
|
<T> void |
configure(String name,
Action<? super T> action)
Looks for the extension with the specified name and configures it with the supplied action.
|
<T> void |
configure(TypeOf<T> type,
Action<? super T> action)
Looks for the extension of the specified type and configures it with the supplied action.
|
<T> T |
create(Class<T> publicType,
String name,
Class<? extends T> instanceType,
Object... constructionArguments)
Creates and adds a new extension to this container.
|
<T> T |
create(String name,
Class<T> type,
Object... constructionArguments)
Creates and adds a new extension to this container.
|
<T> T |
create(TypeOf<T> publicType,
String name,
Class<? extends T> instanceType,
Object... constructionArguments)
Creates and adds a new extension to this container.
|
Object |
findByName(String name)
Looks for the extension of a given name.
|
<T> T |
findByType(Class<T> type)
Looks for the extension of a given type (useful to avoid casting).
|
<T> T |
findByType(TypeOf<T> type)
Looks for the extension of a given type (useful to avoid casting).
|
Object |
getByName(String name)
Looks for the extension of a given name.
|
<T> T |
getByType(Class<T> type)
Looks for the extension of a given type (useful to avoid casting).
|
<T> T |
getByType(TypeOf<T> type)
Looks for the extension of a given type (useful to avoid casting).
|
ExtraPropertiesExtension |
getExtraProperties()
The extra properties extension in this extension container.
|
Map<String,TypeOf<?>> |
getSchema()
Provides access to all known extensions types.
|
@Incubating <T> void add(Class<T> publicType, String name, T extension)
publicType
.publicType
- The extension public typename
- The name for the extensionextension
- Any object implementing publicType
IllegalArgumentException
- When an extension with the given name already exists.@Incubating <T> void add(TypeOf<T> publicType, String name, T extension)
publicType
.publicType
- The extension public typename
- The name for the extensionextension
- Any object implementing publicType
IllegalArgumentException
- When an extension with the given name already exists.void add(String name, Object extension)
extension.getClass()
unless the extension itself declares a preferred public type via the HasPublicType
protocol.name
- The name for the extensionextension
- Any objectIllegalArgumentException
- When an extension with the given name already exists@Incubating <T> T create(Class<T> publicType, String name, Class<? extends T> instanceType, Object... constructionArguments)
instanceType
will be created using the given constructionArguments
.
The extension will be exposed as publicType
.
The new instance will have been dynamically made ExtensionAware
, which means that you can cast it to ExtensionAware
.T
- the extension public typepublicType
- The extension public typename
- The name for the extensioninstanceType
- The extension instance typeconstructionArguments
- The arguments to be used to construct the extension instanceIllegalArgumentException
- When an extension with the given name already exists.add(Class, String, Object)
@Incubating <T> T create(TypeOf<T> publicType, String name, Class<? extends T> instanceType, Object... constructionArguments)
instanceType
will be created using the given constructionArguments
.
The extension will be exposed as publicType
.
The new instance will have been dynamically made ExtensionAware
, which means that you can cast it to ExtensionAware
.T
- the extension public typepublicType
- The extension public typename
- The name for the extensioninstanceType
- The extension instance typeconstructionArguments
- The arguments to be used to construct the extension instanceIllegalArgumentException
- When an extension with the given name already exists.add(Class, String, Object)
<T> T create(String name, Class<T> type, Object... constructionArguments)
type
will be created using the given constructionArguments
.
The extension will be exposed as type
unless the extension itself declares a preferred public type via the HasPublicType
protocol.
The new instance will have been dynamically made ExtensionAware
, which means that you can cast it to ExtensionAware
.name
- The name for the extensiontype
- The type of the extensionconstructionArguments
- The arguments to be used to construct the extension instanceIllegalArgumentException
- When an extension with the given name already exists.add(String, Object)
@Incubating Map<String,TypeOf<?>> getSchema()
<T> T getByType(Class<T> type) throws UnknownDomainObjectException
type
- extension typeUnknownDomainObjectException
- When the given extension is not found.@Incubating <T> T getByType(TypeOf<T> type) throws UnknownDomainObjectException
type
- extension typeUnknownDomainObjectException
- When the given extension is not found.<T> T findByType(Class<T> type)
type
- extension type@Incubating <T> T findByType(TypeOf<T> type)
type
- extension typeObject getByName(String name) throws UnknownDomainObjectException
name
- extension nameUnknownDomainObjectException
- When the given extension is not found.Object findByName(String name)
name
- extension name@Incubating <T> void configure(Class<T> type, Action<? super T> action)
type
- extension typeaction
- the configure actionUnknownDomainObjectException
- if no extension is found.@Incubating <T> void configure(TypeOf<T> type, Action<? super T> action)
type
- extension typeaction
- the configure actionUnknownDomainObjectException
- if no extension is found.@Incubating <T> void configure(String name, Action<? super T> action)
name
- extension nameaction
- the configure actionUnknownDomainObjectException
- if no extension is found.ExtraPropertiesExtension getExtraProperties()