本文整理汇总了Java中com.google.common.base.Predicates.or方法的典型用法代码示例。如果您正苦于以下问题:Java Predicates.or方法的具体用法?Java Predicates.or怎么用?Java Predicates.or使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.base.Predicates
的用法示例。
在下文中一共展示了Predicates.or方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apis
import com.google.common.base.Predicates; //导入方法依赖的package包/类
private Predicate<RequestHandler> apis(Swagger2Properties swagger2Properties) {
List<Predicate<RequestHandler>> basePackages = new LinkedList<>();
if (swagger2Properties.getBasePackage().isEmpty()) {
basePackages.add(RequestHandlerSelectors.any());
}
for (String basePackage : swagger2Properties.getBasePackage()) {
basePackages.add(RequestHandlerSelectors.basePackage(basePackage));
}
return Predicates.or(basePackages);
}
示例2: getPaths
import com.google.common.base.Predicates; //导入方法依赖的package包/类
private Predicate<String> getPaths() {
return Predicates.or(
s -> Objects.equals(s, "/api/status"),
PathSelectors.ant("/api/platforms/**"),
PathSelectors.ant("/api/csars/**"),
PathSelectors.ant("/api/*")
);
}
示例3: mayHaveKeys
import com.google.common.base.Predicates; //导入方法依赖的package包/类
/** @see #mayHaveKeys(String...) */
public QueryClassifierBuilder mayHaveKeys(Predicate<? super String> p) {
if (mayClassifier == null) {
mayClassifier = p;
} else {
mayClassifier = Predicates.<String>or(mayClassifier, p);
}
return this;
}
示例4: mayNotRepeatKeys
import com.google.common.base.Predicates; //导入方法依赖的package包/类
/** @see #mayNotRepeatKeys(String...) */
public QueryClassifierBuilder mayNotRepeatKeys(Predicate<? super String> p) {
if (onceClassifier == null) {
onceClassifier = p;
} else {
onceClassifier = Predicates.or(onceClassifier, p);
}
return this;
}
示例5: port
import com.google.common.base.Predicates; //导入方法依赖的package包/类
/**
* If a port matcher is specified we assume default ports based on
* scheme, so matching ports (80, 443) matches http://example.com/
* but not https://example.com/ and https://example.com:80/ but not
* https://example.com:10000/
*/
public AuthorityClassifierBuilder port(
Predicate<? super Integer> portIsAllowed) {
Preconditions.checkNotNull(portIsAllowed);
if (allowedPortClassifier == null) {
allowedPortClassifier = portIsAllowed;
} else if (portIsAllowed != Predicates.alwaysFalse()) { // x || false -> x
allowedPortClassifier = Predicates.or(
allowedPortClassifier, portIsAllowed);
}
return this;
}
示例6: getPredicate
import com.google.common.base.Predicates; //导入方法依赖的package包/类
public Predicate<IBlockState> getPredicate(final BlockStateContainer blockState)
{
return Predicates.or(Iterables.transform(this.conditions, new Function<ICondition, Predicate<IBlockState>>()
{
@Nullable
public Predicate<IBlockState> apply(@Nullable ICondition p_apply_1_)
{
return p_apply_1_ == null ? null : p_apply_1_.getPredicate(blockState);
}
}));
}
示例7: ComplexTextPredicate
import com.google.common.base.Predicates; //导入方法依赖的package包/类
@Inject
public ComplexTextPredicate(SpecialCharacterPredicate specialCharacterPredicate, FormattedTextPredicate formattedTextPredicate) {
complexTextPredicate = Predicates.or(specialCharacterPredicate, formattedTextPredicate);
}
示例8: build
import com.google.common.base.Predicates; //导入方法依赖的package包/类
/**
* Builds a classifier based on previous allow/match decisions.
* This may be reused after a call to build and subsequent calls to
* allow/match methods will not affect previously built classifiers.
*/
public QueryClassifier build() {
ImmutableSet<String> mayKeySet = mayKeys.build();
Predicate<? super String> mayKeyClassifier;
if (mayClassifier != null) {
mayKeyClassifier = mayClassifier;
} else if (mayKeySet.isEmpty()) {
// If nothing specified, assume permissive.
mayKeyClassifier = Predicates.alwaysTrue();
} else {
// If a set specified, defer to the set.
mayKeyClassifier = Predicates.<String>alwaysFalse();
}
ImmutableSet<String> onceKeySet = onceKeys.build();
Predicate<? super String> onceKeyClassifier;
if (onceClassifier != null) {
onceKeyClassifier = onceClassifier;
} else {
onceKeyClassifier = Predicates.<String>alwaysFalse();
}
ImmutableSet<String> mustKeySet = mustKeys.build();
ImmutableMap<String, Predicate<? super Optional<String>>> valueClassifierMap =
ImmutableMap.copyOf(valueClassifiers);
// If something may appear once or must appear, then it may appear.
if (!Predicates.alwaysTrue().equals(mayKeyClassifier)) {
if (!Predicates.alwaysFalse().equals(onceKeyClassifier)) {
mayKeyClassifier = Predicates.or(mayKeyClassifier, onceKeyClassifier);
}
mayKeySet = ImmutableSet.<String>builder()
.addAll(mayKeySet)
.addAll(onceKeySet)
.addAll(mustKeySet)
.build();
}
return new QueryClassifierImpl(
mayKeySet,
mayKeyClassifier,
onceKeySet,
onceKeyClassifier,
mustKeySet,
valueClassifierMap);
}
示例9: getPredicate
import com.google.common.base.Predicates; //导入方法依赖的package包/类
public Predicate<IBlockState> getPredicate(BlockStateContainer blockState)
{
final IProperty<?> iproperty = blockState.getProperty(this.key);
if (iproperty == null)
{
throw new RuntimeException(this.toString() + ": Definition: " + blockState + " has no property: " + this.key);
}
else
{
String s = this.value;
boolean flag = !s.isEmpty() && s.charAt(0) == 33;
if (flag)
{
s = s.substring(1);
}
List<String> list = SPLITTER.splitToList(s);
if (list.isEmpty())
{
throw new RuntimeException(this.toString() + ": has an empty value: " + this.value);
}
else
{
Predicate<IBlockState> predicate;
if (list.size() == 1)
{
predicate = this.makePredicate(iproperty, s);
}
else
{
predicate = Predicates.or(Iterables.transform(list, new Function<String, Predicate<IBlockState>>()
{
@Nullable
public Predicate<IBlockState> apply(@Nullable String p_apply_1_)
{
return ConditionPropertyValue.this.makePredicate(iproperty, p_apply_1_);
}
}));
}
return flag ? Predicates.not(predicate) : predicate;
}
}
}
示例10: match
import com.google.common.base.Predicates; //导入方法依赖的package包/类
/**
* If there is no fragment then p will receive the absent optional.
* If there is a fragment then p will receive it with the leading "#".
* RFC 3986 says
* <blockquote>
* two URIs that differ only by the suffix "#" are considered
* different regardless of the scheme.
* </blockquote>
*/
public FragmentClassifierBuilder match(Predicate<? super Optional<String>> p) {
if (this.fragmentPred == null) {
this.fragmentPred = p;
} else {
this.fragmentPred = Predicates.or(this.fragmentPred, p);
}
return this;
}
示例11: or
import com.google.common.base.Predicates; //导入方法依赖的package包/类
/**
* Sugar for creating a new predicate that is the logical disjunction of the given predicates.
*
* @param first
* the first predicate.
* @param second
* the second predicate.
* @param others
* the rest of the predicates. Optional, can be omitted, but when given must not contain {@code null}.
* @return a logical disjunction of the predicates.
*/
public static ProjectTypePredicate or(ProjectTypePredicate first, ProjectTypePredicate second,
ProjectTypePredicate... others) {
return new ProjectTypePredicate(Predicates.or(Lists.asList(first, second, others)));
}