本文整理了Java中com.google.inject.matcher.Matcher
类的一些代码示例,展示了Matcher
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matcher
类的具体详情如下:
包路径:com.google.inject.matcher.Matcher
类名称:Matcher
[英]Returns true or false for a given input.
[中]返回给定输入的true或false。
代码示例来源:origin: com.google.inject/guice
@Override
public boolean matches(T t) {
return a.matches(t) || b.matches(t);
}
代码示例来源: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: eclipse/kapua
@Override
protected void bindInterceptor(Matcher<? super Class<?>> classMatcher, Matcher<? super Method> methodMatcher, MethodInterceptor... interceptors) {
super.bindInterceptor(classMatcher, Matchers.not(SyntheticMethodMatcher.getInstance()).and(methodMatcher), interceptors);
}
}
代码示例来源: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: dhanji/sitebricks
@Override
protected void configure() {
Key<Persister> persisterKey = module.selectorKey(Persister.class);
WorkInterceptor workInterceptor = new WorkInterceptor(persisterKey);
TransactionInterceptor transactionInterceptor = new TransactionInterceptor(persisterKey);
requestInjection(workInterceptor);
requestInjection(transactionInterceptor);
Matcher<AnnotatedElement> workMatcher = annotatedWith(Work.class);
Matcher<AnnotatedElement> txnMatcher = annotatedWith(Transactional.class);
// Visible persistence APIs.
if (module.selector != null) {
workMatcher = workMatcher.and(annotatedWith(module.selector));
txnMatcher = txnMatcher.and(annotatedWith(module.selector));
}
bindInterceptor(any(), workMatcher, workInterceptor);
bindInterceptor(any(), txnMatcher, transactionInterceptor);
}
}
代码示例来源:origin: com.google.inject/guice
@Override
public boolean matches(T t) {
return !delegate.matches(t);
}
代码示例来源:origin: ops4j/peaberry
@Override
protected void configure() {
bind(SingletonRoot.class).asEagerSingleton();
install(trackerModule(
subclassesOf(SingletonRoot.class),
annotatedWith(Start.class).or(annotatedWith(Stop.class))));
}
}
代码示例来源:origin: caelum/vraptor
bindListener(not(isApplication).and(not(isSession)), new ScopeLifecycleListener(GuiceProvider.REQUEST));
代码示例来源:origin: com.google.inject/guice
@Override
public boolean matches(T t) {
return a.matches(t) && b.matches(t);
}
代码示例来源: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: com.google.inject/guice
boolean matches(Method method) {
return methodMatcher.matches(method);
}
代码示例来源: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.google.inject/guice
boolean matches(Class<?> clazz) {
return classMatcher.matches(clazz);
}
代码示例来源: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.inject/guice
@Override
public boolean matches(Method m) {
return returnType.matches(m.getReturnType());
}
代码示例来源: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: apache/shiro
public boolean matches(TypeLiteral typeLiteral) {
return classMatcher.matches(typeLiteral.getRawType());
}
};
代码示例来源: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: com.google.inject/guice
@Override
public boolean matches(TypeLiteral<?> typeLiteral) {
Type type = typeLiteral.getType();
if (!(type instanceof Class)) {
return false;
}
Class<?> clazz = (Class<?>) type;
return typeMatcher.matches(clazz);
}
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!