Java 类com.google.inject.name.Names 实例源码

项目:violet    文件:LazyTest.java   
@Test
public void testLazy() {
  final Injector injector = Guice.createInjector(new AbstractModule() {
    @Override
    protected void configure() {
      this.bind(Thing.class).to(ThingA.class);
      this.bindLazy(Thing.class).annotatedWith(Names.named("b")).to(ThingB.class);
      this.bindLazy(Thing.class).annotatedWith(Names.named("c")).to(ThingC.class);
    }
  });
  final Things things = injector.getInstance(Things.class);
  assertNotSame(things.ap.get(), things.ap.get());
  assertSame(things.al.get(), things.al.get());
  assertSame(things.bl.get(), things.bl.get());
  assertSame(things.cl.get(), things.cl.get());
  assertSame(things.dl.get(), things.dl.get());
}
项目:violet    文件:DuplexTest.java   
@Test
public void testNotExposed() {
  final Injector injector = Guice.createInjector(new AbstractModule() {
    @Override
    protected void configure() {
      DuplexBinder.create(this.binder()).install(new DuplexModule() {
        @Override
        protected void configure() {
          this.bind(Thing.class).annotatedWith(Names.named("r0")).toInstance(new Thing("r0"));
        }
      });
    }
  });
  try {
    injector.getInstance(ShouldNotWork.class);
  } catch(final ConfigurationException expected) {
    final String message = expected.getMessage();
    if(message.contains("It was already configured on one or more child injectors or private modules")
      && message.contains("If it was in a PrivateModule, did you forget to expose the binding?")) {
      return;
    }
  }
  fail("should not be exposed");
}
项目:rotabuilder    文件:DomainApplication.java   
@Override
protected Module newIsisWicketModule() {
    final Module isisDefaults = super.newIsisWicketModule();

    final Module overrides = new AbstractModule() {
        @Override
        protected void configure() {
            bind(ComponentFactoryRegistrar.class).to(MyComponentFactoryRegistrar.class);

            bind(String.class).annotatedWith(Names.named("applicationName")).toInstance("RotaBuilder");
            bind(String.class).annotatedWith(Names.named("applicationCss")).toInstance("css/application.css");
            bind(String.class).annotatedWith(Names.named("applicationJs")).toInstance("scripts/application.js");
            bind(String.class).annotatedWith(Names.named("welcomeMessage")).toInstance(readLines(getClass(), "welcome.html"));
            bind(String.class).annotatedWith(Names.named("aboutMessage")).toInstance("RotaBuilder");
            bind(InputStream.class).annotatedWith(Names.named("metaInfManifest")).toProvider(
                    Providers.of(getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF")));
            // if uncommented, then overrides isis.appManifest in config file.
            // bind(AppManifest.class).toInstance(new DomainAppAppManifest());
        }
    };

    return Modules.override(isisDefaults).with(overrides);
}
项目:nifi-config    文件:ProcessorServiceTest.java   
@Test(expected = ConfigException.class)
public void setStateExceptionTest() {
    Injector injector = Guice.createInjector(new AbstractModule() {
        protected void configure() {
            bind(ProcessorsApi.class).toInstance(processorsApiMock);
            bind(Integer.class).annotatedWith(Names.named("timeout")).toInstance(1);
            bind(Integer.class).annotatedWith(Names.named("interval")).toInstance(1);
            bind(Boolean.class).annotatedWith(Names.named("forceMode")).toInstance(false);
        }
    });
    ProcessorService processorService = injector.getInstance(ProcessorService.class);
    ProcessorEntity processor = TestUtils.createProcessorEntity("id", "name");
    processor.getComponent().setState(ProcessorDTO.StateEnum.STOPPED);

    ProcessorEntity processorResponse = TestUtils.createProcessorEntity("id", "name");
    processorResponse.getComponent().setState(ProcessorDTO.StateEnum.RUNNING);
    when(processorsApiMock.updateProcessor(eq("id"), any() )).thenThrow(new ApiException());
    when(processorsApiMock.getProcessor(eq("id") )).thenReturn(processorResponse);

    processorService.setState(processor, ProcessorDTO.StateEnum.RUNNING);
}
项目:Equella    文件:PropertiesModule.java   
@SuppressWarnings("unchecked")
protected <T> void bindClass(TypeLiteral<T> key, String property)
{
    String value = Strings.nullToEmpty(getPropString(property)).trim();
    if( !Check.isEmpty(value) )
    {
        try
        {
            Class<?> clazz = getClass().getClassLoader().loadClass(value);
            bind(key).annotatedWith(Names.named(property)).toInstance((T) clazz);
        }
        catch( ClassNotFoundException e )
        {
            throw new ProvisionException("Class not found in property: " + property);
        }
    }
}
项目:clustercode    文件:CancelTaskIT.java   
@Before
public void setUp() throws Exception {
    Properties properties = getMinimalConfiguration();
    injector = Guice.createInjector(Arrays.asList(
        new ApiModule(properties),
        new ClusterModule(),
        new TranscodeModule(properties),
        new ProcessModule(),
        new GlobalModule(),
        new AbstractModule() {
            @Override
            protected void configure() {
                bind(MediaScanSettings.class).to(MediaScanSettingsImpl.class);
                Names.bindProperties(binder(), properties);
            }
        }
    ));

    injector.getInstance(ClusterService.class).joinCluster();
}
项目:Equella    文件:InstitutionModule.java   
@SuppressWarnings("nls")
@Override
protected void configure()
{
    NodeProvider node = node(InstitutionSection.class);
    node.child(ProgressSection.class);
    node.child(TabsSection.class);
    node.child(AutoTestSetupSection.class);
    node.innerChild(AdminTab.class);
    node.innerChild(ImportTab.class);
    node.innerChild(DatabaseTab.class);
    node.innerChild(serverTab());
    node.innerChild(ThreadDumpTab.class);
    node.innerChild(HealthTab.class);
    bind(Object.class).annotatedWith(Names.named("/institutions")).toProvider(node);
}
项目:n4js    文件:N4JSRuntimeModule.java   
@Override
public void configure(Binder binder) {
    super.configure(binder);
    binder.bindConstant()
            .annotatedWith(Names.named("org.eclipse.xtext.validation.CompositeEValidator.USE_EOBJECT_VALIDATOR"))
            .to(false);

    // set-up infrastructure for custom scopes
    final ScopeManager scopeManager = new ScopeManager();
    binder.bind(ScopeManager.class).toInstance(scopeManager);
    binder.bindScope(TransformationScoped.class, scopeManager);

    // setup documentation provider to match jsdoc-style exactly two stars only:
    binder.bind(String.class)
            .annotatedWith(Names.named(AbstractMultiLineCommentProvider.START_TAG))
            .toInstance("/\\*\\*[^*]");
}
项目:nifi-config    文件:PortServiceTest.java   
@Test
public void getByIdOutputTest() throws ApiException, IOException, URISyntaxException {
    Injector injector = Guice.createInjector(new AbstractModule() {
        protected void configure() {
            bind(InputPortsApi.class).toInstance(inputPortsApiMock);
            bind(OutputPortsApi.class).toInstance(outputPortsApiMock);
            bind(Integer.class).annotatedWith(Names.named("timeout")).toInstance(1);
            bind(Integer.class).annotatedWith(Names.named("interval")).toInstance(1);
            bind(Boolean.class).annotatedWith(Names.named("forceMode")).toInstance(false);
        }
    });
    PortService portService = injector.getInstance(PortService.class);
    PortEntity port = new PortEntity();
    port.setComponent(new PortDTO());
    port.getComponent().setId("id");
    when(outputPortsApiMock.getOutputPort("id")).thenReturn(port);
    PortEntity portResult = portService.getById("id", PortDTO.TypeEnum.OUTPUT_PORT);
    assertEquals("id", portResult.getComponent().getId());
}
项目:Equella    文件:GuicePlugin.java   
@SuppressWarnings("unchecked")
@Override
public <T> T getBean(String beanId)
{
    Injector injector = ensureInjector();
    Key<Object> nameKey = Key.get(Object.class, Names.named(beanId));
    Binding<Object> binding = injector.getExistingBinding(nameKey);
    if( binding != null )
    {
        return (T) binding.getProvider().get();
    }
    ClassLoader classLoader = privatePluginService.getClassLoader(pluginId);
    try
    {
        Class<?> clazz = classLoader.loadClass(beanId);
        return (T) injector.getInstance(clazz);
    }
    catch( ClassNotFoundException e )
    {
        throw new RuntimeException(e);
    }
}
项目:Pogamut3    文件:UT2004TCServerModule.java   
@Override
protected void configureModules() {
    super.configureModules();
    addModule(new AbstractModule() {

        @Override
        public void configure() {
            bind(IWorldMessageTranslator.class).to(ServerFSM.class);
            bind(IWorldView.class).to(IVisionWorldView.class);
            bind(IVisionWorldView.class).to(UT2004WorldView.class);
            bind(ComponentDependencies.class).annotatedWith(Names.named(UT2004WorldView.WORLDVIEW_DEPENDENCY)).toProvider(worldViewDependenciesProvider);
            bind(IAgent.class).to(IWorldServer.class);
            bind(IWorldServer.class).to(IUT2004Server.class);
            bind(IUT2004Server.class).to(UT2004TCServer.class);
        }

    });
}
项目:Pogamut3    文件:HSObserverModule.java   
@Override
protected void configureModules() {
    super.configureModules();
    addModule(new AbstractModule() {

        @Override
        public void configure() {
            bind(IWorldMessageTranslator.class).to(ObserverFSM.class);
            bind(IWorldView.class).to(IVisionWorldView.class);
            bind(IVisionWorldView.class).to(UT2004WorldView.class);
            bind(ComponentDependencies.class).annotatedWith(Names.named(UT2004WorldView.WORLDVIEW_DEPENDENCY)).toProvider(worldViewDependenciesProvider);
            bind(IAgent.class).to(IUT2004Observer.class);

            // THIS tells guice it should instantiate our class and not default one
            bind(IUT2004Observer.class).to(HSObserver.class); 
        }

    });
}
项目:nifi-config    文件:MainTest.java   
@Test
public void mainHttpsUndeployTest() throws Exception {
    Injector injector = Guice.createInjector(new AbstractModule() {
        protected void configure() {
            bind(AccessService.class).toInstance(accessServiceMock);
            bind(InformationService.class).toInstance(informationServiceMock);
            bind(TemplateService.class).toInstance(templateServiceMock);
            bind(Integer.class).annotatedWith(Names.named("timeout")).toInstance(10);
            bind(Integer.class).annotatedWith(Names.named("interval")).toInstance(10);
            bind(Boolean.class).annotatedWith(Names.named("forceMode")).toInstance(false);
            bind(Double.class).annotatedWith(Names.named("placeWidth")).toInstance(1200d);
            bind(PositionDTO.class).annotatedWith(Names.named("startPosition")).toInstance(new PositionDTO());
        }
    });
    //given
    PowerMockito.mockStatic(Guice.class);
    Mockito.when(Guice.createInjector((AbstractModule)anyObject())).thenReturn(injector);

    Main.main(new String[]{"-nifi","https://localhost:8080/nifi-api","-branch","\"root>N2\"","-m","undeploy","-noVerifySsl"});
    verify(templateServiceMock).undeploy(Arrays.asList("root","N2"));
}
项目:vars-annotation    文件:MBARIInjectorModule.java   
private void configureAnnotationService(Binder binder) {
    String endpoint = config.getString("annotation.service.url");
    String clientSecret = config.getString("annotation.service.client.secret");
    Duration timeout = config.getDuration("annotation.service.timeout");
    AnnoWebServiceFactory factory = new AnnoWebServiceFactory(endpoint, timeout);
    AuthService authService = new BasicJWTAuthService(factory,
            new Authorization("APIKEY", clientSecret));
    binder.bind(String.class)
            .annotatedWith(Names.named("ANNO_ENDPOINT"))
            .toInstance(endpoint);
    binder.bind(AuthService.class)
            .annotatedWith(Names.named("ANNO_AUTH"))
            .toInstance(authService);
    binder.bind(AnnoWebServiceFactory.class).toInstance(factory);
    binder.bind(AnnotationService.class).to(AnnoService.class);
}
项目:Pogamut3    文件:UT2004CommunicationModule.java   
@Override
protected void configureModules() {
    super.configureModules();
    addModule(new AbstractModule() {

        @Override
        public void configure() {
            bind(IWorldConnection.class).to(SocketConnection.class);
            bind(ComponentDependencies.class).annotatedWith(Names.named(SocketConnection.CONNECTION_DEPENDENCY)).toProvider(connectionDependenciesProvider);
               bind(ISocketConnectionAddress.class).annotatedWith(Names.named(SocketConnection.CONNECTION_ADDRESS_DEPENDENCY)).toProvider((Provider<ISocketConnectionAddress>) getAddressProvider());
            bind(IWorldMessageParser.class).to(UT2004Parser.class);
            bind(ItemTypeTranslator.class).to(UT2004ItemTypeTranslator.class);
            bind(IYylex.class).to(IUT2004Yylex.class);
            bind(IUT2004Yylex.class).to(Yylex.class);
            bind(IYylexObserver.class).to(IYylexObserver.LogObserver.class);
            bind(UT2004AgentParameters.class).toProvider(getAgentParamsProvider());
        }

    });
}
项目:Pogamut3    文件:UT2004ServerModule.java   
@Override
protected void configureModules() {
    super.configureModules();
    addModule(new AbstractModule() {

        @Override
        public void configure() {
            bind(IWorldMessageTranslator.class).to(ServerFSM.class);
            bind(IWorldView.class).to(IVisionWorldView.class);
            bind(IVisionWorldView.class).to(UT2004WorldView.class);
            bind(ComponentDependencies.class).annotatedWith(Names.named(UT2004WorldView.WORLDVIEW_DEPENDENCY)).toProvider(worldViewDependenciesProvider);
            bind(IAgent.class).to(IWorldServer.class);
            bind(IWorldServer.class).to(IUT2004Server.class);
            bind(IUT2004Server.class).to(UT2004Server.class);               
        }

    });
}
项目:nifi-config    文件:PortServiceTest.java   
/**
 * Creates a token for accessing the REST API via username/password
 * <p>
 * The token returned is formatted as a JSON Web Token (JWT). The token is base64 encoded and comprised of three parts. The header, the body, and the signature. The expiration of the token is a contained within the body. The token can be used in the Authorization header in the format &#39;Authorization: Bearer &lt;token&gt;&#39;.
 *
 * @throws ApiException if the Api call fails
 */
@Test
public void getByIdInputTest() throws ApiException, IOException, URISyntaxException {
    Injector injector = Guice.createInjector(new AbstractModule() {
        protected void configure() {
            bind(InputPortsApi.class).toInstance(inputPortsApiMock);
            bind(OutputPortsApi.class).toInstance(outputPortsApiMock);
            bind(Integer.class).annotatedWith(Names.named("timeout")).toInstance(1);
            bind(Integer.class).annotatedWith(Names.named("interval")).toInstance(1);
            bind(Boolean.class).annotatedWith(Names.named("forceMode")).toInstance(false);
        }
    });
    PortService portService = injector.getInstance(PortService.class);
    PortEntity port = new PortEntity();
    port.setComponent(new PortDTO());
    port.getComponent().setId("id");
    when(inputPortsApiMock.getInputPort("id")).thenReturn(port);
    PortEntity portResult = portService.getById("id", PortDTO.TypeEnum.INPUT_PORT);
    assertEquals("id", portResult.getComponent().getId());
}
项目:Equella    文件:PropertiesModule.java   
protected void bindLong(String property)
{
    String value = Strings.nullToEmpty(getPropString(property)).trim();
    if( !Check.isEmpty(value) )
    {
        bind(Long.class).annotatedWith(Names.named(property)).toInstance(Long.parseLong(value));
    }
}
项目:Equella    文件:MyContentModule.java   
@Override
protected void configure()
{
    super.configure();
    NodeProvider contribute = node(MyContentContributeSection.class);
    contribute.child(MyContentHandlerDelegationSection.class);
    bind(Object.class).annotatedWith(Names.named("/access/mycontent")).toProvider(contribute);
}
项目:ceidg-captcha    文件:CEIDGCaptchaPropertiesModule.java   
@Override
protected void configure() {
    try {
        Properties properties = new Properties();
        ClassLoader classLoader = this.getClass().getClassLoader();
        properties.load(classLoader.getResourceAsStream(propertiesFileName));
        Names.bindProperties(binder(), properties);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
项目:nifi-config    文件:ControllerServicesServiceTest.java   
@Test
public void updateControllerServiceTest() throws InterruptedException {
    Injector injector = Guice.createInjector(new AbstractModule() {
        protected void configure() {
            bind(ControllerServicesApi.class).toInstance(controllerServicesApiMock);
            bind(Integer.class).annotatedWith(Names.named("timeout")).toInstance(1);
            bind(Integer.class).annotatedWith(Names.named("interval")).toInstance(1);
            bind(Boolean.class).annotatedWith(Names.named("forceMode")).toInstance(false);
        }
    });
    ControllerServiceEntity controllerServiceDisabled = TestUtils.createControllerServiceEntity("id","name");
    controllerServiceDisabled.getComponent().setState(ControllerServiceDTO.StateEnum.DISABLED);
    ControllerServiceEntity controllerServiceEnabled = TestUtils.createControllerServiceEntity("id","name");
    controllerServiceEnabled.getComponent().setState(ControllerServiceDTO.StateEnum.ENABLED);
    ControllerServiceEntity controllerService = TestUtils.createControllerServiceEntity("id","name");

    when(controllerServicesApiMock.getControllerService("id")).thenReturn(controllerServiceDisabled).thenReturn(controllerServiceEnabled);

    when(controllerServicesApiMock.updateControllerService(eq("id"), any()))
            .thenReturn(controllerServiceDisabled)
            .thenReturn(controllerService)
            .thenReturn(controllerServiceEnabled);

    ControllerServicesService controllerServicesService = injector.getInstance(ControllerServicesService.class);

    ControllerServiceDTO component = new ControllerServiceDTO();
    component.getProperties().put("key", "value");
    controllerServicesService.updateControllerService(component, controllerService, false);

    ArgumentCaptor<ControllerServiceEntity> controllerServiceCapture = ArgumentCaptor.forClass(ControllerServiceEntity.class);
    verify(controllerServicesApiMock, times(1)).updateControllerService(eq("id"),controllerServiceCapture.capture());
   // assertEquals("id", controllerServiceCapture.getAllValues().get(0).getComponent().getId());
   // assertEquals(ControllerServiceDTO.StateEnum.DISABLED, controllerServiceCapture.getAllValues().get(0).getComponent().getState());
    assertEquals("id", controllerServiceCapture.getAllValues().get(0).getComponent().getId());
    assertEquals("value", controllerServiceCapture.getAllValues().get(0).getComponent().getProperties().get("key"));
 //   assertEquals("id", controllerServiceCapture.getAllValues().get(2).getComponent().getId());
 //   assertEquals(ControllerServiceDTO.StateEnum.ENABLED, controllerServiceCapture.getAllValues().get(2).getComponent().getState());
}
项目:mynlp    文件:GuiceTest.java   
public static void main(String[] args) {
    Injector inject = Guice.createInjector(binder -> {
        binder.bind(A.class).toInstance(new A().set("p"));
    });
    Injector c1 = inject.createChildInjector(binder -> {
        binder.bind(A.class).annotatedWith(Names.named("a")).toInstance(new A());
    });
    Injector c2 = inject.createChildInjector();
    System.out.println(c1.getInstance(Key.get(A.class, Names.named("a"))));
    System.out.println(c2.getInstance(A.class));
}
项目:Equella    文件:SchedulerModule.java   
@Override
protected void configure()
{
    bind(Object.class).annotatedWith(Names.named("/access/settings/scheduledtasks")).toProvider(
        node(RootScheduledTasksSettingsSection.class));

    bind(Object.class).annotatedWith(Names.named("/access/scheduledtasksdebug")).toProvider(
        node(ScheduledTasksDebug.class));
}
项目:nifi-config    文件:ProcessGroupServiceTest.java   
@Test
public void createDirectoryNotExitingTest() throws ApiException, IOException, URISyntaxException {
    List<String> branch = Arrays.asList("root", "elt2");

    ProcessGroupFlowEntity responseRoot = TestUtils.createProcessGroupFlowEntity("root", "root");
    responseRoot.getProcessGroupFlow().getFlow()
            .getProcessGroups().add(TestUtils.createProcessGroupEntity("idElt1", "elt1"));
    when(flowApiMock.getFlow(responseRoot.getProcessGroupFlow().getId())).thenReturn(responseRoot);
    ProcessGroupFlowEntity responseElt = TestUtils.createProcessGroupFlowEntity("idElt2", "elt2");
    when(processGroupsApiMock.createProcessGroup(any(), any())).thenReturn(TestUtils.createProcessGroupEntity("idElt2", "elt2"));
    when(flowApiMock.getFlow(responseElt.getProcessGroupFlow().getId())).thenReturn(responseElt);

    Injector injector = Guice.createInjector(new AbstractModule() {
        protected void configure() {
            bind(ProcessGroupService.class).toInstance(processGroupService);
            bind(ProcessGroupsApi.class).toInstance(processGroupsApiMock);
            bind(ProcessorService.class).toInstance(processorServiceMock);
            bind(ConnectionService.class).toInstance(connectionServiceMock);
            bind(FlowApi.class).toInstance(flowApiMock);
            bind(Integer.class).annotatedWith(Names.named("timeout")).toInstance(1);
            bind(Integer.class).annotatedWith(Names.named("interval")).toInstance(1);
            bind(Boolean.class).annotatedWith(Names.named("forceMode")).toInstance(false);
            bind(Double.class).annotatedWith(Names.named("placeWidth")).toInstance(1200d);
            bind(PositionDTO.class).annotatedWith(Names.named("startPosition")).toInstance(Main.createPosition("0,0"));
        }
    });
    ProcessGroupFlowEntity response = injector.getInstance(ProcessGroupService.class).createDirectory(branch);
    assertEquals("idElt2", response.getProcessGroupFlow().getId());
}
项目:Orion    文件:OrionCore.java   
private <T> ModContainer<T> initializeMod(ClassWrapper<T> modClass, ModInfo modInfo) {
    /* Set up mod event bus */
    EventBus modEventBus = new EventBus();

    /* Set up configuration loader */
    Path configurationPath;
    ConfigurationLoader<CommentedConfigurationNode> configurationLoader;
    try {
        configurationPath = Paths.get(BlackboardKey.get(BlackboardKey.MOD_CONFIGS_PATH).toString(), modInfo.getId() + ".cfg");
        if(Files.notExists(configurationPath.getParent())) Files.createDirectories(configurationPath.getParent());
        configurationLoader = HoconConfigurationLoader.builder()
                .setPath(configurationPath)
                .build();
    } catch (IOException e) {
        throw new RuntimeException(e);
    }

    /* Set up dependency injector */
    Injector injector = baseInjector.createChildInjector(b -> {
        b.bind(ModInfo.class).toInstance(modInfo);
        b.bind(EventBus.class).toInstance(modEventBus);
        b.bind(Logger.class).toInstance(LogManager.getLogger(modInfo.getId()));
        b.bind(COMMENTED_CONFIGURATION_NODE_LOADER).toInstance(configurationLoader);
        b.bind(Path.class).annotatedWith(Names.named("configurationPath"))
                .toInstance(configurationPath);
    });

    return new ModContainer<>(modClass, modInfo, injector, modEventBus);
}
项目:bromium    文件:DefaultModuleTest.java   
@Test
public void canSupplyMeasurementsFile() {
    String measurementsFile = "measurements.csv";
    Map<String, Object> opts = new HashMap<>();
    opts.put(MEASUREMENTS, measurementsFile);
    Module module = new DefaultModule(REPLAY, opts);
    Injector injector = Guice.createInjector(module);

    File actualMeasurementsFile = injector.getInstance(Key.get(File.class, Names.named(MEASUREMENTS_FILE)));
    assertEquals(measurementsFile, actualMeasurementsFile.getName());

    File actualHarFile = injector.getInstance(Key.get(File.class, Names.named(HAR_FILE)));
    assertEquals(measurementsFile + HAR_EXTENSION, actualHarFile.getName());
}
项目:n4js    文件:N4JSRuntimeModule.java   
/**
 * Sets the scope provider to use as delegate for the local scope provider. This delegate is used to handle imported
 * elements. The customization makes elements that name is equal to the resource name both referenceable by e.g
 * my/pack/A/A as well as my/pack/A if the resource name is A. In this delegate later the import of the built in
 * types should be made.
 */
public void configureIScopeProviderDelegate(Binder binder) {
    binder.bind(org.eclipse.xtext.scoping.IScopeProvider.class)
            .annotatedWith(
                    com.google.inject.name.Names
                            .named(org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.NAMED_DELEGATE))
            .to(N4JSImportedNamespaceAwareLocalScopeProvider.class);
}
项目:Equella    文件:PropertiesModule.java   
protected void bindURL(String property)
{
    String value = Strings.nullToEmpty(getPropString(property)).trim();
    if( !Check.isEmpty(value) )
    {
        try
        {
            bind(URL.class).annotatedWith(Names.named(property)).toInstance(new URL(value));
        }
        catch( MalformedURLException e )
        {
            throw new ProvisionException("Invalid url in property: " + property, e);
        }
    }
}
项目:Equella    文件:ContentRestrictionsModule.java   
@Override
protected void configure()
{
    bind(Object.class).annotatedWith(Names.named("/access/contentrestrictions")).toProvider(
        contentRestrictionsTree());

}
项目:Equella    文件:BrightspaceIntegrationModule.java   
@Override
protected void configure()
{
    bind(Object.class).annotatedWith(Names.named("/brightspacenavbar"))
        .toProvider(new BrightspaceSignonNodeProvider(BrightspaceSignon.SESSION_TYPE_NAVBAR));
    bind(Object.class).annotatedWith(Names.named("/brightspacequicklink"))
        .toProvider(new BrightspaceSignonNodeProvider(BrightspaceSignon.SESSION_TYPE_QUICKLINK));
    bind(Object.class).annotatedWith(Names.named("/brightspacecoursebuilder"))
        .toProvider(new BrightspaceSignonNodeProvider(BrightspaceSignon.SESSION_TYPE_COURSEBUILDER));
    bind(Object.class).annotatedWith(Names.named("/brightspaceinsertstuff"))
        .toProvider(new BrightspaceSignonNodeProvider(BrightspaceSignon.SESSION_TYPE_INSERTSTUFF));
    install(new BrightspaceLtiOptionalModule());
}
项目:Java-9-Programming-By-Example    文件:MastermindModule.java   
@Override
protected void configure() {
    bind(int.class).annotatedWith(Names.named("nrColors")).toInstance(6);
    bind(int.class).annotatedWith(Names.named("nrColumns")).toInstance(4);
    bind(ColorFactory.class).to(LetteredColorFactory.class);
    bind(Guesser.class).to(UniqueGuesser.class);
}
项目:Pogamut3    文件:UT2004MultiBotModule.java   
@Override
protected void configureModules() {
    super.configureModules();
    addModule(new AbstractModule() {

        @Override
        public void configure() {   

            bind(IWorldMessageTranslator.class).to(BotFSM.class);
            bind(IWorldView.class).to(IVisionWorldView.class);
            bind(IVisionWorldView.class).to(ILockableVisionWorldView.class);
            bind(ILockableWorldView.class).to(ILockableVisionWorldView.class);
            bind(ILockableVisionWorldView.class).to(LocalWorldViewAdapter.class);
            bind(BatchAwareLocalWorldView.class).to(UT2004LockableLocalWorldView.class);
            bind(ISharedWorldView.class).to(UT2004BatchAwareSharedWorldView.class);

            bind(IComponentBus.class).to(ILifecycleBus.class);
            bind(ILifecycleBus.class).to(LifecycleBus.class);

            bind(ITeamedAgentId.class).to(TeamedAgentId.class);
            bind(TeamedAgentId.class).toProvider( getTeamedAgentIdProvider());

            bind(ComponentDependencies.class).annotatedWith(Names.named(UT2004LockableLocalWorldView.WORLDVIEW_DEPENDENCY)).toProvider(worldViewDependenciesProvider);
            bind(IAgent.class).to(IAgent3D.class);
            bind(IAgent3D.class).to(IUT2004Bot.class);
            bind(IUT2004Bot.class).to(UT2004Bot.class);

            if (botControllerClass != null) {
                bind(IUT2004BotController.class).to(botControllerClass);
            }

        }

    });
}
项目:Equella    文件:RemoteRepoModule.java   
@SuppressWarnings("nls")
@Override
protected void configure()
{
    bind(Object.class).annotatedWith(Names.named("/access/remoterepo")).toProvider(
        node(RemoteRepoListAllSection.class));
}
项目:lcdsl    文件:AbstractLcDslUiModule.java   
public void configureIPreferenceStoreInitializer(Binder binder) {
    binder.bind(IPreferenceStoreInitializer.class)
        .annotatedWith(Names.named("RefactoringPreferences"))
        .to(RefactoringPreferences.Initializer.class);
}
项目:pokemon-tcgo-deck-generator    文件:AbstractPkmntcgoRuntimeModule.java   
public void configureIScopeProviderDelegate(Binder binder) {
    binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(ImportedNamespaceAwareLocalScopeProvider.class);
}
项目:pokemon-tcgo-deck-generator    文件:AbstractPkmntcgoUiModule.java   
public void configureContentAssistLexer(Binder binder) {
    binder.bind(Lexer.class)
        .annotatedWith(Names.named(LexerIdeBindings.CONTENT_ASSIST))
        .to(InternalPkmntcgoLexer.class);
}
项目:gemoc-studio    文件:AbstractDslUiModule.java   
public void configureHighlightingLexer(Binder binder) {
    binder.bind(org.eclipse.xtext.parser.antlr.Lexer.class)
        .annotatedWith(Names.named(LexerIdeBindings.HIGHLIGHTING))
        .to(org.eclipse.gemoc.parser.antlr.internal.InternalDslLexer.class);
}
项目:pokemon-tcgo-deck-generator    文件:AbstractPkmntcgoUiModule.java   
public void configureHighlightingTokenDefProvider(Binder binder) {
    binder.bind(ITokenDefProvider.class)
        .annotatedWith(Names.named(LexerIdeBindings.HIGHLIGHTING))
        .to(AntlrTokenDefProvider.class);
}
项目:Equella    文件:ScriptedPortletEditorModule.java   
@SuppressWarnings("nls")
@Override
protected void configure()
{
    bind(Object.class).annotatedWith(Names.named("freemarkerPortletEditorTabs")).toProvider(scriptedTree());
}
项目:org.xtext.dsl.restaurante    文件:AbstractRestauranteUiModule.java   
public void configureHighlightingTokenDefProvider(Binder binder) {
    binder.bind(ITokenDefProvider.class)
        .annotatedWith(Names.named(LexerIdeBindings.HIGHLIGHTING))
        .to(AntlrTokenDefProvider.class);
}