Package com.persequor.extension.ioc
Interface IExtensionPointBinder<T>
- Type Parameters:
T
- General class/interface
public interface IExtensionPointBinder<T>
IOC binder
Usage: Use the bind interface from the IExtensionPointIoc class, to get a binder from your specified generic class. Then call a to method to bind it to the specific implementation or provider. It is intended to be used from the configure method in the IExtensionPointConfiguration
Example:
public void configure(IExtensionPointIoc iExtensionPointIoc) {
iExtensionPointIoc.bind(IService.class).to(CustomService.class);
}
-
Method Summary
Modifier and TypeMethodDescription<E extends T>
voidexclusivelyTo
(Class<E> toClass) Bind exclusively to a class, and let the IOC construct the object for you.void
exclusivelyTo
(javax.inject.Provider<? extends T> provider) Bind exclusively to a provider, where you can construct the object yourself.<E extends T>
voidBind to a class, and let the IOC construct the object for you.void
Bind to a provider, where you can construct the object yourself.
-
Method Details
-
to
Bind to a class, and let the IOC construct the object for you.- Type Parameters:
E
- generic class- Parameters:
toClass
- specific implementation- Throws:
IllegalArgumentException
- if there is an existing exclusive binding
-
to
Bind to a provider, where you can construct the object yourself.- Parameters:
provider
- the provider implementation- Throws:
IllegalArgumentException
- if there is an existing exclusive binding
-
exclusivelyTo
Bind exclusively to a class, and let the IOC construct the object for you. This method will fail if there is any existing binding. If it succeeds, all future attempts to bind will fail.- Type Parameters:
E
- generic class- Parameters:
toClass
- specific implementation- Throws:
IllegalArgumentException
- if there is any existing binding
-
exclusivelyTo
Bind exclusively to a provider, where you can construct the object yourself. This method will fail if there is any existing binding. If it succeeds, all future attempts to bind will fail.- Parameters:
provider
- the provider implementation- Throws:
IllegalArgumentException
- if there is any existing binding
-