本文整理汇总了Java中org.elasticsearch.common.inject.name.Names类的典型用法代码示例。如果您正苦于以下问题:Java Names类的具体用法?Java Names怎么用?Java Names使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Names类属于org.elasticsearch.common.inject.name包,在下文中一共展示了Names类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import org.elasticsearch.common.inject.name.Names; //导入依赖的package包/类
@Override
protected void configure() {
bind(IndexDeletionPolicy.class)
.annotatedWith(Names.named("actual"))
.to(KeepOnlyLastDeletionPolicy.class)
.asEagerSingleton();
bind(SnapshotDeletionPolicy.class)
.asEagerSingleton();
}
示例2: configure
import org.elasticsearch.common.inject.name.Names; //导入依赖的package包/类
@Override
protected void configure() {
bind(ObjectMapper.class).toInstance(new ObjectMapper());
bind(StatusRestHandler.class).asEagerSingleton();
bind(SearchRestHandler.class).asEagerSingleton();
bind(ProjectsRestHandler.class).asEagerSingleton();
bind(ShowRestHandler.class).asEagerSingleton();
bind(InitRestHandler.class).asEagerSingleton();
bind(String.class).annotatedWith(Names.named("codeIndex")).toInstance("devsearch");
}
示例3: configure
import org.elasticsearch.common.inject.name.Names; //导入依赖的package包/类
@Override
protected void configure() {
bind(String.class).annotatedWith(Names.named("appName")).toInstance("elasticshell");
bind(InputStream.class).annotatedWith(Names.named("shellInput")).toInstance(System.in);
bind(PrintStream.class).annotatedWith(Names.named("shellOutput")).toInstance(new PrintStream(System.out, true));
bind(ShutdownHook.class).asEagerSingleton();
bind(ResourceRegistry.class).to(DefaultResourceRegistry.class).asEagerSingleton();
bind(Scheduler.class).to(DefaultScheduler.class).asEagerSingleton();
}
示例4: getInstance
import org.elasticsearch.common.inject.name.Names; //导入依赖的package包/类
/**
* Returns an instance of the given type with the {@link org.elasticsearch.common.inject.name.Named}
* annotation value.
* <p>
* This method allows you to switch this code
* <code>injector.getInstance(Key.get(type, Names.named(name)));</code>
* <p>
* to the more concise
* <code>Injectors.getInstance(injector, type, name);</code>
*/
public static <T> T getInstance(Injector injector, java.lang.Class<T> type, String name) {
return injector.getInstance(Key.get(type, Names.named(name)));
}