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.void
ThrowsIllegalStateException
if binding is not complete.void
ThrowsIllegalStateException
if 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 implementationboolean
isBound()
ServiceBinder.isBound()
method implementation.boolean
Returns the value set bysetSingleton(boolean)
method;false
if 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:
getService
in interfaceServiceBinder<T>
- Returns:
- a service corresponding to this
service binder
-
getProcessBinder
ServiceBinder.getProcessBinder()
method implementation- Specified by:
getProcessBinder
in interfaceServiceBinder<T>
- Returns:
- a
process binder
for which thisservice binder
is created
-
addLibrariesProvider
ServiceBinder.addLibrariesProvider(ILibrariesProvider)
method implementation.- Specified by:
addLibrariesProvider
in interfaceServiceBinder<T>
- Parameters:
librariesProvider
- givenlibrariesProvider
(notnull
)- Returns:
- this instance
-
addLibraries
ServiceBinder.addLibraries(String...)
method implementation.- Specified by:
addLibraries
in 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:
addAdditionalClassesProvider
in interfaceServiceBinder<T>
- Parameters:
additionalClassesProvider
- givenadditionalClassesProvider
(notnull
)- Returns:
- this instance
-
addAdditionalClasses
ServiceBinder.addAdditionalClasses(Class...)
method implementation.- Specified by:
addAdditionalClasses
in interfaceServiceBinder<T>
- Parameters:
additionalClasses
- given additional classes (notnull
)- Returns:
- this instance
-
setSingleton
ServiceBinder.setSingleton(boolean)
method implementation.- Specified by:
setSingleton
in interfaceServiceBinder<T>
- Parameters:
singleton
- given parameter- Returns:
- this instance
-
bindTo
ServiceBinder.bindTo(Class)
method implementation.- Specified by:
bindTo
in 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
ProcessBinder
for that thisservice binder
is created.
-
isBound
public boolean isBound()ServiceBinder.isBound()
method implementation.- Specified by:
isBound
in interfaceServiceBinder<T>
- Returns:
true
if this binding is complete,false
otherwise
-
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),
IllegalStateException
will be thrown.- Specified by:
getLibraries
in 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),
IllegalStateException
will be thrown.- Specified by:
getAdditionalClasses
in 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),
IllegalStateException
will be thrown.- Specified by:
getImplementation
in 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;false
if this value was not set. If the binding is not complete (not bound already),IllegalStateException
will be thrown.- Specified by:
isSingleton
in interfaceServiceBinder<T>
- Returns:
- the value set by
setSingleton(boolean)
method;false
if this value was not set - Throws:
IllegalStateException
- if the binding is not complete (not bound already)
-
checkNotBound
public void checkNotBound()ThrowsIllegalStateException
if binding is complete. -
checkBound
public void checkBound()ThrowsIllegalStateException
if binding is not complete.
-