Package kos.api
Interface ImplementationLoader
- All Known Implementing Classes:
ImplementationLoader.SPIImplementationLoader
public interface ImplementationLoader
Loads implementations.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classCustomized optional result.static class -
Method Summary
Modifier and TypeMethodDescriptiondefault <T> ImplementationLoader.Result<T>anyInstanceOf(Class<T> type) Load the instance of the giventype.<T> ImplementationLoader.Result<T>instanceOf(Class<T> type) Load the instance of the giventype.default <T> TinstanceOfOrFail(Class<T> type) Load the instance of the giventype.<T> Iterable<T>instancesExposedAs(Class<T> interfaceType) Loads classes exposed by the giveninterfaceType.<T> void
-
Method Details
-
instancesExposedAs
Loads classes exposed by the giveninterfaceType.- Type Parameters:
T- same type asinterfaceType- Parameters:
interfaceType- an abstract class or interface in which concrete implementations is expected to be loaded- Returns:
- found implementations or empty
Iterableif none was found.
-
instanceOf
Load the instance of the giventype.- Type Parameters:
T- same type astype- Parameters:
type- expected class to be loaded.- Returns:
- an
Optionalinstance containing or not the found instance.
-
instanceOfOrFail
Load the instance of the giventype.- Type Parameters:
T- same type astype- Parameters:
type- expected class to be loaded.- Returns:
- found instance
- Throws:
KosException- if not instance was found.
-
anyInstanceOf
Load the instance of the giventype. It will try first to lookup for instances usinginstanceOf(java.lang.Class<T>). If fail, it will return the first one returned byinstancesExposedAs(Class). If none has been found,Optional.empty()will be returned.- Type Parameters:
T- same type astype- Parameters:
type- expected class to be loaded.- Returns:
- an
Optionalinstance containing or not the found instance.
-
register
-