public interface Extendable<O>
Modifier and Type | Method and Description |
---|---|
<E extends Extension<O>> |
addExtension(Class<? super E> type,
E extension)
Add en extension to this extendable object.
|
<E extends Extension<O>> |
getExtension(Class<? super E> type)
Get an extension based on its class type.
|
<E extends Extension<O>> |
getExtensionByName(String name)
Get an extension based on its name.
|
<E extends Extension<O>> |
getExtensions()
Get all extensions associated with this extendable object..
|
default String |
getImplementationName()
Returns a name that is used to find matching
ExtensionAdderProvider s
when selecting implementations of extensions in newExtension(java.lang.Class<B>) . |
default <E extends Extension<O>,B extends ExtensionAdder<O,E>> |
newExtension(Class<B> type)
Returns an extensionAdder to build and add an extension for this extendable.
|
<E extends Extension<O>> |
removeExtension(Class<E> type)
Remove an extension based on its class type.
|
<E extends Extension<O>> void addExtension(Class<? super E> type, E extension)
E
- the extension typetype
- the extension class typeextension
- the extension<E extends Extension<O>> E getExtension(Class<? super E> type)
E
- the extension typetype
- the extension class type<E extends Extension<O>> E getExtensionByName(String name)
name
- the extension name<E extends Extension<O>> boolean removeExtension(Class<E> type)
E
- the extension typetype
- the extension class type<E extends Extension<O>> Collection<E> getExtensions()
default String getImplementationName()
ExtensionAdderProvider
s
when selecting implementations of extensions in newExtension(java.lang.Class<B>)
. This
is meant to be overriden by extendables when multiple implementations exist.default <E extends Extension<O>,B extends ExtensionAdder<O,E>> B newExtension(Class<B> type)
The extension implementation is selected at runtime based on matching the
getImplementationName()
of this extendable to the
ExtensionAdderProvider.getImplementationName()
of a provider.
Implementations are loaded with java's ServiceLoader
using
the ExtensionAdderProvider interface.
type
- The interface of the ExtensionAdderCopyright © 2020. All rights reserved.