本文整理了Java中com.google.inject.matcher.Matcher.or()
方法的一些代码示例,展示了Matcher.or()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matcher.or()
方法的具体详情如下:
包路径:com.google.inject.matcher.Matcher
类名称:Matcher
方法名:or
[英]Returns a new matcher which returns true if either this or the given matcher return true.
[中]返回一个新的匹配器,如果该匹配器或给定的匹配器返回true,则该匹配器返回true。
代码示例来源:origin: net.spals.appbuilder/spals-appbuilder-app-core
@Override
protected void configure() {
final Matcher typeMatcher = annotatedWith(Path.class)
.or(annotatedWith(Provider.class))
.or(rawTypeThat(subclassesOf(DynamicFeature.class)))
.or(rawTypeThat(subclassesOf(ExceptionMapper.class)))
.or(rawTypeThat(subclassesOf(ContainerRequestFilter.class)))
.or(rawTypeThat(subclassesOf(ContainerResponseFilter.class)));
bindListener(typeMatcher, this);
}
代码示例来源:origin: net.spals.appbuilder.plugins/spals-appbuilder-app-grpc
@Override
protected void configure() {
final Matcher typeMatcher = rawTypeThat(subclassesOf(BindableService.class))
.or(rawTypeThat(subclassesOf(ServerServiceDefinition.class)))
.or(rawTypeThat(subclassesOf(ServerInterceptor.class)))
.or(rawTypeThat(subclassesOf(ServerTransportFilter.class)))
.or(rawTypeThat(subclassesOf(HandlerRegistry.class)))
.or(rawTypeThat(subclassesOf(DecompressorRegistry.class)))
.or(rawTypeThat(subclassesOf(CompressorRegistry.class)));
bindListener(typeMatcher, this);
}
代码示例来源:origin: ops4j/peaberry
@Override
protected void configure() {
bind(SingletonRoot.class).asEagerSingleton();
install(trackerModule(
subclassesOf(SingletonRoot.class),
annotatedWith(Start.class).or(annotatedWith(Stop.class))));
}
}
代码示例来源:origin: br.com.objectos/sitebricks
public void start() {
Set<Class<?>> set = Sets.newHashSet();
for (Package pkg : packages) {
//look for any classes annotated with @At, @EmbedAs and @With
set.addAll(Classes.matching(
annotatedWith(At.class).or(
annotatedWith(EmbedAs.class)).or(
annotatedWith(With.class)).or(
annotatedWith(Show.class))
).in(pkg));
}
//we need to scan all the pages first (do not collapse into the next loop)
Set<PageBook.Page> pagesToCompile = scanPagesToCompile(set);
collectBindings(bindings, pagesToCompile);
extendedPages(pagesToCompile);
// Compile templates for scanned classes (except in dev mode, where faster startup
// time is more important and compiles are amortized across visits to each page).
// TODO make this configurable separately to stage for GAE
if (Stage.DEVELOPMENT != currentStage) {
compilePages(pagesToCompile);
}
// Start all services.
List<Binding<Aware>> bindings = injector.findBindingsByType(AWARE_TYPE);
for (Binding<Aware> binding : bindings) {
binding.getProvider().get().startup();
}
//set application mode to started (now debug mechanics can kick in)
metrics.activate();
}
代码示例来源:origin: com.google.sitebricks/sitebricks
public void start() {
Set<Class<?>> set = Sets.newHashSet();
for (Package pkg : packages) {
//look for any classes annotated with @At, @EmbedAs and @With
set.addAll(Classes.matching(
annotatedWith(At.class).or(
annotatedWith(EmbedAs.class)).or(
annotatedWith(With.class)).or(
annotatedWith(Show.class))
).in(pkg));
}
//we need to scan all the pages first (do not collapse into the next loop)
Set<PageBook.Page> pagesToCompile = scanPagesToCompile(set);
collectBindings(bindings, pagesToCompile);
extendedPages(pagesToCompile);
// Compile templates for scanned classes (except in dev mode, where faster startup
// time is more important and compiles are amortized across visits to each page).
// TODO make this configurable separately to stage for GAE
if (Stage.DEVELOPMENT != currentStage) {
compilePages(pagesToCompile);
}
// Start all services.
List<Binding<Aware>> bindings = injector.findBindingsByType(AWARE_TYPE);
for (Binding<Aware> binding : bindings) {
binding.getProvider().get().startup();
}
//set application mode to started (now debug mechanics can kick in)
metrics.activate();
}
代码示例来源:origin: dhanji/sitebricks
public void start() {
Set<Class<?>> set = Sets.newHashSet();
for (Package pkg : packages) {
//look for any classes annotated with @At, @EmbedAs and @With
set.addAll(Classes.matching(
annotatedWith(At.class).or(
annotatedWith(EmbedAs.class)).or(
annotatedWith(With.class)).or(
annotatedWith(Show.class))
).in(pkg));
}
//we need to scan all the pages first (do not collapse into the next loop)
Set<PageBook.Page> pagesToCompile = scanPagesToCompile(set);
collectBindings(bindings, pagesToCompile);
extendedPages(pagesToCompile);
// Compile templates for scanned classes (except in dev mode, where faster startup
// time is more important and compiles are amortized across visits to each page).
// TODO make this configurable separately to stage for GAE
if (Stage.DEVELOPMENT != currentStage) {
compilePages(pagesToCompile);
}
// Start all services.
List<Binding<Aware>> bindings = injector.findBindingsByType(AWARE_TYPE);
for (Binding<Aware> binding : bindings) {
binding.getProvider().get().startup();
}
//set application mode to started (now debug mechanics can kick in)
metrics.activate();
}
代码示例来源:origin: yangfuhai/jboot
/**
* module implements
*
* @param binder
*/
@Override
public void configure(Binder binder) {
// 设置 TypeListener
binder.bindListener(Matchers.any(), this);
Matcher matcher = Matchers.annotatedWith(Bean.class)
.or(Matchers.annotatedWith(JbootrpcService.class))
.or(Matchers.annotatedWith(Before.class));
Matcher notSynthetic = new AbstractMatcher<Method>() {
@Override
public boolean matches(Method method) {
return !method.isSynthetic();
}
};
binder.bindInterceptor(matcher, notSynthetic, new AopInterceptor());
/**
* Bean 注解
*/
beanBind(binder);
//自定义aop configure
JbootAppListenerManager.me().onGuiceConfigure(binder);
}
代码示例来源:origin: com.cognifide.qa.bb/bb-core
@Override
protected void configure() {
FrameAspect frameAspect = new FrameAspect();
requestInjection(frameAspect);
bindInterceptor(annotatedWith(PageObject.class).or(annotatedWith(Frame.class)), any(),
frameAspect);
bindInterceptor(not(annotatedWith(PageObject.class)), annotatedWith(Frame.class), frameAspect);
}
代码示例来源:origin: Cognifide/bobcat
@Override
protected void configure() {
FrameAspect frameAspect = new FrameAspect();
requestInjection(frameAspect);
bindInterceptor(annotatedWith(PageObject.class).or(annotatedWith(Frame.class)), any(),
frameAspect);
bindInterceptor(not(annotatedWith(PageObject.class)), annotatedWith(Frame.class), frameAspect);
}
代码示例来源:origin: ops4j/peaberry
@Override
protected void configure() {
bind(RenamingConfigRoot.class).in(Singleton.class);
bindConfigurable(Integer.class).annotatedWith(named(CONF_A_NAME)).from(CONF_PID).named(CONF_A_KEY);
bindConfigurable(Integer.class).annotatedWith(ConfigValue.class).from(CONF_PID).named(CONF_B_KEY);
bindConfigurable(Integer.class).from(CONF_PID).named(CONF_C_KEY);
install(trackerModule(
subclassesOf(RenamingConfigRoot.class),
annotatedWith(Start.class).or(annotatedWith(Stop.class)).or(annotatedWith(Inject.class))));
}
}
代码示例来源:origin: ops4j/peaberry
@Override
protected void configure() {
bind(ConfigRoot.class).in(Singleton.class);
bindConfigurable(Integer.class).from(CONF_PID).named(CONF_A);
bindConfigurable(Integer.class).from(CONF_PID).named(CONF_B);
bindConfigurable(Integer.class).from(CONF_PID).named(CONF_C);
install(trackerModule(
subclassesOf(ConfigRoot.class),
annotatedWith(Start.class).or(annotatedWith(Stop.class)).or(annotatedWith(Inject.class))));
}
}
代码示例来源:origin: ops4j/peaberry
@Override
protected void configure() {
bind(DualConfigRoot.class).in(Singleton.class);
bindConfigurable(Integer.class).from(CONF_PID_A).named(CONF_AA);
bindConfigurable(Integer.class).from(CONF_PID_A).named(CONF_AB);
bindConfigurable(Integer.class).from(CONF_PID_A).named(CONF_AC);
bindConfigurable(Integer.class).from(CONF_PID_B).named(CONF_BA);
bindConfigurable(Integer.class).from(CONF_PID_B).named(CONF_BB);
bindConfigurable(Integer.class).from(CONF_PID_B).named(CONF_BC);
install(trackerModule(
subclassesOf(DualConfigRoot.class),
annotatedWith(Start.class).or(annotatedWith(Stop.class)).or(annotatedWith(Inject.class))));
}
}
内容来源于网络,如有侵权,请联系作者删除!