Package com._1c.g5.internal.wiring
Class InjectorAwareServiceRegistrationBuilder<T>
java.lang.Object
com._1c.g5.internal.wiring.ServiceRegistrationBuilder<T>
com._1c.g5.internal.wiring.InjectorAwareServiceRegistrationBuilder<T>
- All Implemented Interfaces:
IInjectorAwareServiceRegistrationBuilder<T>,IServiceRegistrationBuilder<T>
- Direct Known Subclasses:
InjectorAwareManagedServiceRegistrationBuilder
public class InjectorAwareServiceRegistrationBuilder<T>
extends ServiceRegistrationBuilder<T>
implements IInjectorAwareServiceRegistrationBuilder<T>
Implementation of
IInjectorAwareServiceRegistrationBuilder.-
Field Summary
Fields inherited from class com._1c.g5.internal.wiring.ServiceRegistrationBuilder
context, properties, registerationConsumer, serviceType -
Constructor Summary
ConstructorsConstructorDescriptionInjectorAwareServiceRegistrationBuilder(Class<T> serviceType, org.osgi.framework.BundleContext context, Consumer<org.osgi.framework.ServiceRegistration<T>> registerationConsumer, Supplier<com.google.inject.Injector> injectorSupplier) Constructor ofInjectorAwareServiceRegistrationBuilder. -
Method Summary
Modifier and TypeMethodDescriptionvoidRegister the service interface with implemetation from the parent Guice injector with the same type as builder service type key.voidregisterInjected(com.google.inject.Key<? extends T> registerTypeKey) Register the service interface with implemetation from the given Guice injector with the given injector implemetation type key.voidregisterInjected(com.google.inject.TypeLiteral<? extends T> typeLiteral) Register the service interface with implemetation from the parent Guice injector with the given injector type literal as key.voidregisterInjected(Class<? extends T> registerType) Register the service interface with implemetation from the parent Guice injector with the given injector type key.voidregisterInjected(Class<? extends T> registerType, Annotation annotation) Register the service interface with implemetation from the parent Guice injector with the given injector type and annotation as key.withProperties(Map<String, ?> properties) Associate the given properties map with registering service.withProperty(String key, Object value) Associate the given property with registering service.Methods inherited from class com._1c.g5.internal.wiring.ServiceRegistrationBuilder
prepareInstance, properties, registerInstanceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com._1c.g5.wiring.IServiceRegistrationBuilder
registerInstance
-
Constructor Details
-
InjectorAwareServiceRegistrationBuilder
public InjectorAwareServiceRegistrationBuilder(Class<T> serviceType, org.osgi.framework.BundleContext context, Consumer<org.osgi.framework.ServiceRegistration<T>> registerationConsumer, Supplier<com.google.inject.Injector> injectorSupplier) Constructor ofInjectorAwareServiceRegistrationBuilder.- Parameters:
serviceType- the service type to register, cannot benullcontext- the bundle context to register service in, cannot benullregisterationConsumer- the consumer to call when service will be registered, cannot benullinjectorSupplier- the Guice injector supplier to use, cannot benull
-
-
Method Details
-
withProperty
Description copied from interface:IServiceRegistrationBuilderAssociate the given property with registering service. All builded properties will be combined.- Specified by:
withPropertyin interfaceIInjectorAwareServiceRegistrationBuilder<T>- Specified by:
withPropertyin interfaceIServiceRegistrationBuilder<T>- Overrides:
withPropertyin classServiceRegistrationBuilder<T>- Parameters:
key- the propertyStringkey, cannot benullvalue- the property value, cannot benull- Returns:
- a reference to this builder, never
null
-
withProperties
Description copied from interface:IServiceRegistrationBuilderAssociate the given properties map with registering service. All builded properties will be combined.- Specified by:
withPropertiesin interfaceIInjectorAwareServiceRegistrationBuilder<T>- Specified by:
withPropertiesin interfaceIServiceRegistrationBuilder<T>- Overrides:
withPropertiesin classServiceRegistrationBuilder<T>- Parameters:
properties- the properties map, cannot benull- Returns:
- a reference to this builder, never
null
-
registerInjected
public void registerInjected()Description copied from interface:IInjectorAwareServiceRegistrationBuilderRegister the service interface with implemetation from the parent Guice injector with the same type as builder service type key.Instances cardinality is controlled by the Guice injector binding scope: binded injector
Providerwill be used to get instances of services during service consumer OSGi service access.- Specified by:
registerInjectedin interfaceIInjectorAwareServiceRegistrationBuilder<T>
-
registerInjected
Description copied from interface:IInjectorAwareServiceRegistrationBuilderRegister the service interface with implemetation from the parent Guice injector with the given injector type key.Single instance of service will be registered regardless of injector binding scope and provider settings.
- Specified by:
registerInjectedin interfaceIInjectorAwareServiceRegistrationBuilder<T>- Parameters:
registerType- the implemetation type to get from injector and register, cannot benull
-
registerInjected
Description copied from interface:IInjectorAwareServiceRegistrationBuilderRegister the service interface with implemetation from the parent Guice injector with the given injector type and annotation as key.Single instance of service will be registered regardless of injector binding scope and provider settings.
- Specified by:
registerInjectedin interfaceIInjectorAwareServiceRegistrationBuilder<T>- Parameters:
registerType- the implemetation type to get from injector and register, cannot benullannotation- he injector implemetation annotation to register, cannot benull
-
registerInjected
Description copied from interface:IInjectorAwareServiceRegistrationBuilderRegister the service interface with implemetation from the parent Guice injector with the given injector type literal as key.Single instance of service will be registered regardless of injector binding scope and provider settings.
- Specified by:
registerInjectedin interfaceIInjectorAwareServiceRegistrationBuilder<T>- Parameters:
typeLiteral- the implemetation type literal to get from injector and register, cannot benull
-
registerInjected
Description copied from interface:IInjectorAwareServiceRegistrationBuilderRegister the service interface with implemetation from the given Guice injector with the given injector implemetation type key.Single instance of service will be registered regardless of injector binding scope and provider settings.
- Specified by:
registerInjectedin interfaceIInjectorAwareServiceRegistrationBuilder<T>- Parameters:
registerTypeKey- the implemetation type key to get from injector and register, cannot benull
-