Package com.e1c.langtool.v8.dt.xtext
Class AbstractRspModule
java.lang.Object
com.google.inject.AbstractModule
com._1c.g5.wiring.AbstractServiceAwareModule
com.e1c.langtool.v8.dt.xtext.AbstractRspModule
- All Implemented Interfaces:
com.google.inject.Module
Abstract Guice module with helper methods to bind services from OSGi service registry and Xtext resource service
provider registry by language resource extension.
Clients may extend this class, implement AbstractServiceAwareModule.doConfigure(), and call the inherited methods with
extended DSL, that allows to bind toService(...).
Example of usage:
public class MyModule extends AbstractRspModule
{
public MyModule(BundleContext context)
{
super(context);
}
@Override
protected void doConfigure()
{
// bind plug-in internal local services
bind(IInternalService.class).to(InternalService.class).in(Singleton.class);
bind(IOtherInternalService.class).to(OtherInternalService.class);
// bind neccessary imported OSGi services
bind(IPublicService.class).toService();
bind(IPublicQualifiedService.class).annotatedWith(Names.named("MdImplementation"))
.toService(IPublicQualifiedService.class, ServiceProperties.named("MdImplementation"));
// bind service from Resource Service provider registry by resource file extension name
bindToRspService(IScopeProvider, "dslext");
}
}
- See Also:
-
AbstractModuleServicePropertiesAbstractServiceAwareModule
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractRspModule(org.eclipse.core.runtime.Plugin bundle) Constructor ofAbstractServiceAwareModule.AbstractRspModule(org.osgi.framework.BundleContext context) Constructor ofAbstractRspModule. -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> com.google.inject.binder.ScopedBindingBuilderbindToRspService(Class<T> clazz, String fileExt) Bind service toRSPservice.Methods inherited from class com._1c.g5.wiring.AbstractServiceAwareModule
bind, bind, bind, configure, doConfigureMethods inherited from class com.google.inject.AbstractModule
addError, addError, addError, bindConstant, binder, bindInterceptor, bindListener, bindListener, bindScope, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestInjection, requestStaticInjection, requireBinding, requireBinding
-
Constructor Details
-
AbstractRspModule
public AbstractRspModule(org.osgi.framework.BundleContext context) Constructor ofAbstractRspModule.- Parameters:
context- the parent bundle context, cannot benull
-
AbstractRspModule
public AbstractRspModule(org.eclipse.core.runtime.Plugin bundle) Constructor ofAbstractServiceAwareModule.- Parameters:
bundle- the parent bundle, cannot benull
-
-
Method Details
-
bindToRspService
protected <T> com.google.inject.binder.ScopedBindingBuilder bindToRspService(Class<T> clazz, String fileExt) Bind service toRSPservice.- Type Parameters:
T- the generic type of the service, cannot benull- Parameters:
clazz- the class object of the service to obtain form RSP registry, cannot benullfileExt- the language file extension of the Xtext resource, cannot benull- Throws:
IllegalStateException- if cannot find RSP for given language file extension or if serivce not found in RSP- See Also:
-
Binder.bind(Class)
-