Class ServiceBinderImpl<T>
- All Implemented Interfaces:
ServiceBinder<T>
ServiceBinder implementation.
Provides some additional methods used in implementation.-
Method Summary
Modifier and TypeMethodDescriptionaddAdditionalClasses(Class<?>... additionalClasses) ServiceBinder.addAdditionalClasses(Class...)method implementation.addAdditionalClassesProvider(IAdditionalClassesProvider additionalClassesProvider) ServiceBinder.addAdditionalClassesProvider(IAdditionalClassesProvider)method implementation.addLibraries(String... librariesToAdd) ServiceBinder.addLibraries(String...)method implementation.addLibrariesProvider(ILibrariesProvider librariesProvider) ServiceBinder.addLibrariesProvider(ILibrariesProvider)method implementation.ServiceBinder.bindTo(Class)method implementation.voidThrowsIllegalStateExceptionif binding is not complete.voidThrowsIllegalStateExceptionif binding is complete.Collection<Class<?>>Returns all the additional classes were added to this binder in case of binding is complete.Returns the bound implementation class in case of binding is complete.String[]Returns all the libraries were added to this binder in case of binding is complete.ServiceBinder.getProcessBinder()method implementationServiceBinder.getService()method implementationbooleanisBound()ServiceBinder.isBound()method implementation.booleanReturns the value set bysetSingleton(boolean)method;falseif this value was not set.static <T> ServiceBinderImpl<T>newInstance(ProcessBinderImpl processBinderImpl, Class<T> service) Creates a new instance with given processBinder for given service.setSingleton(boolean singleton) ServiceBinder.setSingleton(boolean)method implementation.
-
Method Details
-
newInstance
public static <T> ServiceBinderImpl<T> newInstance(ProcessBinderImpl processBinderImpl, Class<T> service) Creates a new instance with given processBinder for given service. If given service is not interface, throwsIllegalArgumentException.- Parameters:
processBinder- given processBinder (notnull)service- given service (must be interface, notnull)
-
getService
ServiceBinder.getService()method implementation- Specified by:
getServicein interfaceServiceBinder<T>- Returns:
- a service corresponding to this
service binder
-
getProcessBinder
ServiceBinder.getProcessBinder()method implementation- Specified by:
getProcessBinderin interfaceServiceBinder<T>- Returns:
- a
process binderfor which thisservice binderis created
-
addLibrariesProvider
ServiceBinder.addLibrariesProvider(ILibrariesProvider)method implementation.- Specified by:
addLibrariesProviderin interfaceServiceBinder<T>- Parameters:
librariesProvider- givenlibrariesProvider(notnull)- Returns:
- this instance
-
addLibraries
ServiceBinder.addLibraries(String...)method implementation.- Specified by:
addLibrariesin interfaceServiceBinder<T>- Parameters:
librariesToAdd- given list of libraries (notnull)- Returns:
- this instance
-
addAdditionalClassesProvider
public ServiceBinderImpl<T> addAdditionalClassesProvider(IAdditionalClassesProvider additionalClassesProvider) ServiceBinder.addAdditionalClassesProvider(IAdditionalClassesProvider)method implementation.- Specified by:
addAdditionalClassesProviderin interfaceServiceBinder<T>- Parameters:
additionalClassesProvider- givenadditionalClassesProvider(notnull)- Returns:
- this instance
-
addAdditionalClasses
ServiceBinder.addAdditionalClasses(Class...)method implementation.- Specified by:
addAdditionalClassesin interfaceServiceBinder<T>- Parameters:
additionalClasses- given additional classes (notnull)- Returns:
- this instance
-
setSingleton
ServiceBinder.setSingleton(boolean)method implementation.- Specified by:
setSingletonin interfaceServiceBinder<T>- Parameters:
singleton- given parameter- Returns:
- this instance
-
bindTo
ServiceBinder.bindTo(Class)method implementation.- Specified by:
bindToin interfaceServiceBinder<T>- Parameters:
implementation- given implementation of service to bind to service for process with key key. Must be instantiable class. Notnull.- Returns:
- instance of
ProcessBinderfor that thisservice binderis created.
-
isBound
public boolean isBound()ServiceBinder.isBound()method implementation.- Specified by:
isBoundin interfaceServiceBinder<T>- Returns:
trueif this binding is complete,falseotherwise
-
getLibraries
Returns all the libraries were added to this binder in case of binding is complete. If the binding is not complete (not bound already),
IllegalStateExceptionwill be thrown.- Specified by:
getLibrariesin interfaceServiceBinder<T>- Returns:
- all the libraries were added to this binder (not
null) - Throws:
IllegalStateException- if the binding is not complete (not bound already)
-
getAdditionalClasses
Returns all the additional classes were added to this binder in case of binding is complete. If the binding is not complete (not bound already),
IllegalStateExceptionwill be thrown.- Specified by:
getAdditionalClassesin interfaceServiceBinder<T>- Returns:
- all the additional classes were added to this binder (not
null) - Throws:
IllegalStateException- if the binding is not complete (not bound already)
-
getImplementation
Returns the bound implementation class in case of binding is complete. If the binding is not complete (not bound already),
IllegalStateExceptionwill be thrown.- Specified by:
getImplementationin interfaceServiceBinder<T>- Returns:
- the bound implementation class (not
null) - Throws:
IllegalStateException- if the binding is not complete (not bound already)
-
isSingleton
public boolean isSingleton()Returns the value set by
setSingleton(boolean)method;falseif this value was not set. If the binding is not complete (not bound already),IllegalStateExceptionwill be thrown.- Specified by:
isSingletonin interfaceServiceBinder<T>- Returns:
- the value set by
setSingleton(boolean)method;falseif this value was not set - Throws:
IllegalStateException- if the binding is not complete (not bound already)
-
checkNotBound
public void checkNotBound()ThrowsIllegalStateExceptionif binding is complete. -
checkBound
public void checkBound()ThrowsIllegalStateExceptionif binding is not complete.
-