- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.netflix.spectator.impl.matcher.ZeroOrMoreMatcher.repeated()
方法的一些代码示例,展示了ZeroOrMoreMatcher.repeated()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZeroOrMoreMatcher.repeated()
方法的具体详情如下:
包路径:com.netflix.spectator.impl.matcher.ZeroOrMoreMatcher
类名称:ZeroOrMoreMatcher
方法名:repeated
[英]Return the matcher for the repeated portion.
[中]返回重复部分的匹配器。
代码示例来源:origin: Netflix/spectator
/**
* Zero or more start anchors is the same as not being anchored by the start.
*/
static Matcher removeRepeatedStart(Matcher matcher) {
if (matcher instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm = matcher.as();
if (zm.repeated() instanceof StartMatcher) {
return zm.next();
}
}
return matcher;
}
代码示例来源:origin: com.netflix.spectator/spectator-api
/**
* Zero or more start anchors is the same as not being anchored by the start.
*/
static Matcher removeRepeatedStart(Matcher matcher) {
if (matcher instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm = matcher.as();
if (zm.repeated() instanceof StartMatcher) {
return zm.next();
}
}
return matcher;
}
代码示例来源:origin: com.netflix.spectator/spectator-api
/**
* If a start anchor is followed by a repeated any match, then the start anchor can be removed
* as it will not change the result ({@code "^.*" => ".*"}).
*/
static Matcher removeStartFollowedByMatchAny(Matcher matcher) {
if (matcher instanceof SeqMatcher) {
List<Matcher> matchers = matcher.<SeqMatcher>as().matchers();
if (matchers.size() == 2
&& matchers.get(0) instanceof StartMatcher
&& matchers.get(1) instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm = matchers.get(1).as();
if (zm.repeated() instanceof AnyMatcher) {
return zm;
}
}
}
return matcher;
}
代码示例来源:origin: Netflix/spectator
/**
* If a start anchor is followed by a repeated any match, then the start anchor can be removed
* as it will not change the result ({@code "^.*" => ".*"}).
*/
static Matcher removeStartFollowedByMatchAny(Matcher matcher) {
if (matcher instanceof SeqMatcher) {
List<Matcher> matchers = matcher.<SeqMatcher>as().matchers();
if (matchers.size() == 2
&& matchers.get(0) instanceof StartMatcher
&& matchers.get(1) instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm = matchers.get(1).as();
if (zm.repeated() instanceof AnyMatcher) {
return zm;
}
}
}
return matcher;
}
代码示例来源:origin: Netflix/spectator
/**
* Adjacent any matches can be consolidated, e.g., ({@code ".*.*" => ".*"}).
*/
static Matcher removeSequentialMatchAny(Matcher matcher) {
if (matcher instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm1 = matcher.as();
if (zm1.repeated() instanceof AnyMatcher && zm1.next() instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm2 = zm1.next().as();
if (zm2.repeated() instanceof AnyMatcher) {
return zm2;
}
}
}
return matcher;
}
代码示例来源:origin: com.netflix.spectator/spectator-api
/**
* Adjacent any matches can be consolidated, e.g., ({@code ".*.*" => ".*"}).
*/
static Matcher removeSequentialMatchAny(Matcher matcher) {
if (matcher instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm1 = matcher.as();
if (zm1.repeated() instanceof AnyMatcher && zm1.next() instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm2 = zm1.next().as();
if (zm2.repeated() instanceof AnyMatcher) {
return zm2;
}
}
}
return matcher;
}
代码示例来源:origin: Netflix/spectator
/**
* If the match after a repeated pattern is false, then treat the whole match as false.
* For example: {@code ".*$." => "$."}.
*/
static Matcher zeroOrMoreFalse(Matcher matcher) {
if (matcher instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm = matcher.as();
if (zm.repeated() instanceof FalseMatcher || zm.next() instanceof FalseMatcher) {
return zm.next();
}
}
return matcher;
}
代码示例来源:origin: com.netflix.spectator/spectator-api
/**
* Remove match any pattern at the end, e.g., ({@code "foo.*$" => "foo"}).
*/
static Matcher removeTrailingMatchAny(Matcher matcher) {
if (matcher instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm = matcher.as();
boolean atEnd = zm.next() instanceof TrueMatcher || zm.next() instanceof EndMatcher;
if (atEnd && zm.repeated() instanceof AnyMatcher) {
return TrueMatcher.INSTANCE;
}
}
return matcher;
}
代码示例来源:origin: Netflix/spectator
/**
* Remove match any pattern at the end, e.g., ({@code "foo.*$" => "foo"}).
*/
static Matcher removeTrailingMatchAny(Matcher matcher) {
if (matcher instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm = matcher.as();
boolean atEnd = zm.next() instanceof TrueMatcher || zm.next() instanceof EndMatcher;
if (atEnd && zm.repeated() instanceof AnyMatcher) {
return TrueMatcher.INSTANCE;
}
}
return matcher;
}
代码示例来源:origin: com.netflix.spectator/spectator-api
/**
* If the match after a repeated pattern is false, then treat the whole match as false.
* For example: {@code ".*$." => "$."}.
*/
static Matcher zeroOrMoreFalse(Matcher matcher) {
if (matcher instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm = matcher.as();
if (zm.repeated() instanceof FalseMatcher || zm.next() instanceof FalseMatcher) {
return zm.next();
}
}
return matcher;
}
代码示例来源:origin: Netflix/spectator
/**
* Adjacent any matches can be consolidated, e.g., ({@code ".*(.*foo)" => ".*foo"}).
*/
static Matcher removeMatchAnyFollowedByIndexOf(Matcher matcher) {
if (matcher instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm = matcher.as();
if (zm.repeated() instanceof AnyMatcher
&& PatternUtils.getPrefix(zm.next()) instanceof IndexOfMatcher) {
return zm.next();
}
}
return matcher;
}
代码示例来源:origin: Netflix/spectator
/**
* Get the prefix matcher. This is similar to {@link #head(Matcher)} except that it can
* reach into character sequences as well as higher level sequences.
*/
static Matcher getPrefix(Matcher matcher) {
if (matcher instanceof SeqMatcher) {
List<Matcher> ms = matcher.<SeqMatcher>as().matchers();
return ms.get(0);
} else if (matcher instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm = matcher.as();
return new ZeroOrMoreMatcher(zm.repeated(), TrueMatcher.INSTANCE);
} else if (matcher instanceof CharSeqMatcher) {
String pattern = matcher.<CharSeqMatcher>as().pattern();
return pattern.isEmpty() ? null : new CharSeqMatcher(pattern.charAt(0));
} else {
return matcher;
}
}
代码示例来源:origin: com.netflix.spectator/spectator-api
/**
* Adjacent any matches can be consolidated, e.g., ({@code ".*(.*foo)" => ".*foo"}).
*/
static Matcher removeMatchAnyFollowedByIndexOf(Matcher matcher) {
if (matcher instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm = matcher.as();
if (zm.repeated() instanceof AnyMatcher
&& PatternUtils.getPrefix(zm.next()) instanceof IndexOfMatcher) {
return zm.next();
}
}
return matcher;
}
代码示例来源:origin: com.netflix.spectator/spectator-api
/**
* Get the prefix matcher. This is similar to {@link #head(Matcher)} except that it can
* reach into character sequences as well as higher level sequences.
*/
static Matcher getPrefix(Matcher matcher) {
if (matcher instanceof SeqMatcher) {
List<Matcher> ms = matcher.<SeqMatcher>as().matchers();
return ms.get(0);
} else if (matcher instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm = matcher.as();
return new ZeroOrMoreMatcher(zm.repeated(), TrueMatcher.INSTANCE);
} else if (matcher instanceof CharSeqMatcher) {
String pattern = matcher.<CharSeqMatcher>as().pattern();
return pattern.isEmpty() ? null : new CharSeqMatcher(pattern.charAt(0));
} else {
return matcher;
}
}
代码示例来源:origin: Netflix/spectator
/**
* If the matcher preceding an OR clause is a repeated any match, move into each branch
* of the OR clause. This allows for other optimizations such as conversion to an indexOf
* to take effect for each branch.
*/
static Matcher inlineMatchAnyPrecedingOr(Matcher matcher) {
if (matcher instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm = matcher.as();
if (zm.repeated() instanceof AnyMatcher && zm.next() instanceof OrMatcher) {
List<Matcher> matchers = zm.next().<OrMatcher>as().matchers();
List<Matcher> ms = new ArrayList<>();
for (Matcher m : matchers) {
ms.add(new ZeroOrMoreMatcher(AnyMatcher.INSTANCE, m));
}
return OrMatcher.create(ms);
}
}
return matcher;
}
代码示例来源:origin: com.netflix.spectator/spectator-api
/**
* If the matcher preceding an OR clause is a repeated any match, move into each branch
* of the OR clause. This allows for other optimizations such as conversion to an indexOf
* to take effect for each branch.
*/
static Matcher inlineMatchAnyPrecedingOr(Matcher matcher) {
if (matcher instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm = matcher.as();
if (zm.repeated() instanceof AnyMatcher && zm.next() instanceof OrMatcher) {
List<Matcher> matchers = zm.next().<OrMatcher>as().matchers();
List<Matcher> ms = new ArrayList<>();
for (Matcher m : matchers) {
ms.add(new ZeroOrMoreMatcher(AnyMatcher.INSTANCE, m));
}
return OrMatcher.create(ms);
}
}
return matcher;
}
代码示例来源:origin: Netflix/spectator
/**
* If a start anchor is preceded by a repeated any match, then the any match can be removed
* as it must be empty for the start anchor to match ({@code ".*^" => "^"}).
*/
static Matcher removeMatchAnyFollowedByStart(Matcher matcher) {
if (matcher instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm = matcher.as();
if (zm.repeated() instanceof AnyMatcher
&& zm.next() instanceof SeqMatcher
&& zm.next().<SeqMatcher>as().matchers().get(0).isStartAnchored()) {
return zm.next();
}
}
return matcher;
}
代码示例来源:origin: com.netflix.spectator/spectator-api
/**
* If a start anchor is preceded by a repeated any match, then the any match can be removed
* as it must be empty for the start anchor to match ({@code ".*^" => "^"}).
*/
static Matcher removeMatchAnyFollowedByStart(Matcher matcher) {
if (matcher instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm = matcher.as();
if (zm.repeated() instanceof AnyMatcher
&& zm.next() instanceof SeqMatcher
&& zm.next().<SeqMatcher>as().matchers().get(0).isStartAnchored()) {
return zm.next();
}
}
return matcher;
}
代码示例来源:origin: Netflix/spectator
/**
* If a char sequence is preceded by a repeated any match, then replace with an
* IndexOfMatcher. The index of operation seems to be optimized by the JDK and is
* much faster. Example: {@code ".*foo" => indexOf("foo")}.
*/
static Matcher convertRepeatedAnyCharSeqToIndexOf(Matcher matcher) {
if (matcher instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm1 = matcher.as();
Matcher prefix = PatternUtils.getPrefix(zm1.next());
if (zm1.repeated() instanceof AnyMatcher && prefix instanceof CharSeqMatcher) {
String pattern = prefix.<CharSeqMatcher>as().pattern();
Matcher suffix = PatternUtils.getSuffix(zm1.next());
return new IndexOfMatcher(pattern, suffix);
}
}
return matcher;
}
代码示例来源:origin: com.netflix.spectator/spectator-api
/**
* If a char sequence is preceded by a repeated any match, then replace with an
* IndexOfMatcher. The index of operation seems to be optimized by the JDK and is
* much faster. Example: {@code ".*foo" => indexOf("foo")}.
*/
static Matcher convertRepeatedAnyCharSeqToIndexOf(Matcher matcher) {
if (matcher instanceof ZeroOrMoreMatcher) {
ZeroOrMoreMatcher zm1 = matcher.as();
Matcher prefix = PatternUtils.getPrefix(zm1.next());
if (zm1.repeated() instanceof AnyMatcher && prefix instanceof CharSeqMatcher) {
String pattern = prefix.<CharSeqMatcher>as().pattern();
Matcher suffix = PatternUtils.getSuffix(zm1.next());
return new IndexOfMatcher(pattern, suffix);
}
}
return matcher;
}
我想实现一个转换特性,涵盖支持现有转换的所有类型。我认为这可以通过以下方式完成: impl Into for T where T: Into, { fn into(self) -> B {
看来我不能在 Rust 中调用相同结构的方法,或者我不明白: struct St1 { aa: String } impl St1 { pub fn method1() -> String {
我正在使用 pimpl idiom在我的代码中有很多,主要是为了减少编译时间。 我遇到了调用 C 库的情况。我有一个 C++ 包装器类,它有它的接口(interface),血淋淋的细节都在 impl
我有以下代码: use std::ops::Div; use std::ops::Mul; #[derive(Debug)] struct Foo { bar: T, } impl Foo w
从 Rust 1.34 开始,我们可以通过实现 TryFrom 来编写类型之间的易错转换。特征: struct Foo(i32); struct Bar; impl TryFrom for Foo {
我开始了一个非常小的程序来玩 Rust 中的解析器组合器,很快就遇到了一个我觉得很奇怪的错误: trait Parser { fn parse(&self, input: &'a [u8])
这个问题在这里已经有了答案: NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton() (4 个答案) 关闭 5 年前。
在扩展其他 crate 中定义的 trait 时,似乎有两种方法可以默认实现新的 trait。 特征的原始定义是 pub trait Trait1 { fn f1(&self); } 为了扩展
我通过扩展 AbstractEntryProcessor 创建了用于更新 map 条目的自定义条目处理器。当我的应用程序在两个实例上的集群中运行并且执行入口处理器时,我收到以下异常: com.haze
我的本地环境:OSX 10.9.2,java1.6 我使用 java api 连接 hbase 和 maven 来管理我的项目,我将 Hbase-0.94.17 和 Hadoop-core-1.0
包装一些生成的类,我使用 classImpl 绑定(bind),但生成的类中的集合返回生成的类型而不是 classImpl 中的类型,我当然想要一个 classImpl 列表...... 我的 xsd
我正在编写一个守护程序来获取某些游戏的服务器统计信息。 在编译中我收到一条消息: cannot access org.apache.commons.pool2.impl.GenericObjectPo
我最近将旧应用程序的后台服务迁移到 WorkManager .在最近的设备上(低至 sdk 22 包括 )它看起来不错,运行重复的工作单元并按预期在设备重新启动时安排它们。 问题是当我测试旧版本时(旧
这个问题在这里已经有了答案: Xerces error: org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl (2 个答案) 关闭 5 年前。 我正在使用
如果我有一个需要Default实现的结构,如果所有字段的类型都有Default实现的themsevles,那么我可以使用derive 宏,否则我需要手动实现 Default。但是,在某些情况下,我有一
我看到 Rust 代码库中经常出现以下模式,但我找不到解释为什么要使用它。 将 impl ... for 用于什么目的? build ? 伪代码: impl Handler { pub fn
我用 Angular js 编写了一些小代码。它有效,但我收到一些错误“无法读取未定义的属性'impl'”。有人知道那是什么吗? 这是我的 html:
我正在尝试创建一个通用实现,用于根据不同的字段类型生成 From/Into。 Link to Playground 我发现了以下问题: error[E0425]: cannot find value
在下面传递一个trait作为参数的例子中,在函数签名中发送impl需要什么? 我知道 traits 是更通用的类型而不是具体类型,但是由于 Rust 编译器不允许跨结构和 traits 共享名称,为什
我有一个带有两个通用 typenum 参数的实现。当参数相同时,impl 的函数应该返回不同的类型。 (不同类型是一种更紧凑的表示,只有当类型参数相同时才能实现。)是否可以使用基于类型相等性的不同实现
我是一名优秀的程序员,十分优秀!