Package kos.api
Class ImplementationLoader.SPIImplementationLoader
- java.lang.Object
-
- kos.api.ImplementationLoader.SPIImplementationLoader
-
- All Implemented Interfaces:
ImplementationLoader
- Enclosing interface:
- ImplementationLoader
public static class ImplementationLoader.SPIImplementationLoader extends Object implements ImplementationLoader
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface kos.api.ImplementationLoader
ImplementationLoader.Result<T>, ImplementationLoader.SPIImplementationLoader
-
-
Constructor Summary
Constructors Constructor Description SPIImplementationLoader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> ImplementationLoader.Result<T>instanceOf(Class<T> type)Load the instance of the giventype.<T> Iterable<T>instancesExposedAs(Class<T> interfaceType)Loads classes exposed by the giveninterfaceType.<T> voidregister(Class<T> type, T instance)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface kos.api.ImplementationLoader
anyInstanceOf, instanceOfOrFail
-
-
-
-
Method Detail
-
instancesExposedAs
public <T> Iterable<T> instancesExposedAs(Class<T> interfaceType)
Description copied from interface:ImplementationLoaderLoads classes exposed by the giveninterfaceType.- Specified by:
instancesExposedAsin interfaceImplementationLoader- 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
public <T> ImplementationLoader.Result<T> instanceOf(Class<T> type)
Description copied from interface:ImplementationLoaderLoad the instance of the giventype.- Specified by:
instanceOfin interfaceImplementationLoader- Type Parameters:
T- same type astype- Parameters:
type- expected class to be loaded.- Returns:
- an
Optionalinstance containing or not the found instance.
-
register
public <T> void register(Class<T> type, T instance)
- Specified by:
registerin interfaceImplementationLoader
-
-