public interface CExtProvider<T>
Lookup and will be collected on demand by the CExtManager. It is crucial that implementers take care
about the ordering/positioning within the Lookup. Thus they shall make appropriate use of the
ServiceProvider.position() property.Lookup,
ServiceProvider| Modifier and Type | Method and Description |
|---|---|
boolean |
canProvide(Class<?> c)
Shall return a
boolean indicating whether this provider implementation provides extensions of this
type. |
Class<? extends T> |
getType()
Shall return a
Class that indicates which kind of extensions this implementation of
CExtProvider delivers. |
Collection<? extends T> |
provideExtensions(CExtContext context)
Shall provide extensions for the given context.
|
Collection<? extends T> provideExtensions(CExtContext context)
CExtProvider plans to provide two implementations of MyService, a default one
(DefaultMyService) and a specific one for a special kind of context
(SpecificMyService). If this CExtProvider is requested to provide extensions with the afore
mentioned special kind of context, so that it matches the DefaultMyService and the
SpecificMyService requirements, the returned collection shall have the order [SpecificMyService,
DefaultMyService]. Additionally, if the extension provider will not provide any implementation for a
certain context it shall return an empty collection. This implies that this operation shall never return
null.context - the context for which the extensions are requested, may be nullnullClass<? extends T> getType()
Class that indicates which kind of extensions this implementation of
CExtProvider delivers.nullboolean canProvide(Class<?> c)
boolean indicating whether this provider implementation provides extensions of this
type. Basically this operation is closely related to getType() and may probably do something like
c.isAssignableFrom(getType()). However, this operation can also be implemented in another way to avoid
loading of the extension class if the return value of this operation will be false.c - the type which is tested if instances of it can be produced by this provider implementationtrue if the provider provides instances of the given type, false otherwiseCopyright © 2012–2026 cismet GmbH. All rights reserved.