本文整理汇总了Java中com.google.common.base.Predicates.alwaysTrue方法的典型用法代码示例。如果您正苦于以下问题:Java Predicates.alwaysTrue方法的具体用法?Java Predicates.alwaysTrue怎么用?Java Predicates.alwaysTrue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.base.Predicates
的用法示例。
在下文中一共展示了Predicates.alwaysTrue方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testConcatIntersectionType
import com.google.common.base.Predicates; //导入方法依赖的package包/类
/**
* This test passes if the {@code concat(…).filter(…).filter(…)} statement at the end compiles.
* That statement compiles only if {@link FluentIterable#concat concat(aIterable, bIterable)}
* returns a {@link FluentIterable} of elements of an anonymous type whose supertypes are the
* <a href="https://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.9">intersection</a>
* of the supertypes of {@code A} and the supertypes of {@code B}.
*/
public void testConcatIntersectionType() {
Iterable<A> aIterable = ImmutableList.of();
Iterable<B> bIterable = ImmutableList.of();
Predicate<X> xPredicate = Predicates.alwaysTrue();
Predicate<Y> yPredicate = Predicates.alwaysTrue();
FluentIterable<?> unused =
FluentIterable.concat(aIterable, bIterable).filter(xPredicate).filter(yPredicate);
/* The following fails to compile:
*
* The method append(Iterable<? extends FluentIterableTest.A>) in the type
* FluentIterable<FluentIterableTest.A> is not applicable for the arguments
* (Iterable<FluentIterableTest.B>)
*/
// FluentIterable.from(aIterable).append(bIterable);
/* The following fails to compile:
*
* The method filter(Predicate<? super Object>) in the type FluentIterable<Object> is not
* applicable for the arguments (Predicate<FluentIterableTest.X>)
*/
// FluentIterable.of().append(aIterable).append(bIterable).filter(xPredicate);
}
示例2: OIDCCoreProtocolConfiguration
import com.google.common.base.Predicates; //导入方法依赖的package包/类
/**
* Creates a new configuration instance.
*
* @param profileId Unique profile identifier.
*/
public OIDCCoreProtocolConfiguration(@Nonnull @NotEmpty final String profileId) {
super(profileId);
authenticationFlows = Collections.emptySet();
postAuthenticationFlows = Collections.emptyList();
defaultAuthenticationContexts = Collections.emptyList();
nameIDFormatPrecedence = Collections.emptyList();
signIDTokensPredicate = Predicates.alwaysTrue();
pairwiseSubject = Predicates.alwaysFalse();
}
示例3: getDocIdFilter
import com.google.common.base.Predicates; //导入方法依赖的package包/类
private static Predicate<Symbol> getDocIdFilter(Parameters params) throws IOException {
if (params.isPresent(RESTRICT_TO_THESE_DOCS)) {
final File docIDsFile = params.getExistingFile(RESTRICT_TO_THESE_DOCS);
final ImmutableList<String> docIDsToImport = Files.asCharSource(docIDsFile,
Charsets.UTF_8).readLines();
log.info("Restricting import to {} document IDs in {}",
docIDsToImport.size(), docIDsFile);
return in(SymbolUtils.setFrom(docIDsToImport));
} else {
return Predicates.alwaysTrue();
}
}
示例4: NodeFilters
import com.google.common.base.Predicates; //导入方法依赖的package包/类
NodeFilters(@Nullable String name, @Nullable String id) {
if (name == null && id == null) {
innerPredicate = Predicates.alwaysTrue();
} else {
Predicate<DiscoveryNode> namesPredicate = name == null ? Predicates.<DiscoveryNode>alwaysTrue() : new NamesPredicate(name);
Predicate<DiscoveryNode> idsPredicate = id == null ? Predicates.<DiscoveryNode>alwaysTrue() : new IdsPredicate(id);
innerPredicate = Predicates.and(namesPredicate, idsPredicate);
}
}
示例5: discoveryNodePredicate
import com.google.common.base.Predicates; //导入方法依赖的package包/类
private static Predicate<DiscoveryNode> discoveryNodePredicate(Object[] parameters, @Nullable Expression nodeFiltersExpression) {
if (nodeFiltersExpression == null) {
return Predicates.alwaysTrue();
}
Object nodeFiltersObj = ExpressionToObjectVisitor.convert(nodeFiltersExpression, parameters);
try {
return NodeFilters.fromMap((Map) nodeFiltersObj);
} catch (ClassCastException e) {
throw new IllegalArgumentException(String.format(Locale.ENGLISH,
"Invalid parameter passed to %s. Expected an object with name or id keys and string values. Got '%s'",
NodeFilters.NAME, nodeFiltersObj));
}
}
示例6: 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 AuthorityClassifier build() {
ImmutableSet<Inet4Address> ipv4Set = ipv4s.build();
ImmutableSet<Inet6Address> ipv6Set = ipv6s.build();
ImmutableSet<InternetDomainName> domainNameSet = domainNames.build();
HostGlobMatcher hostGlobMatcher = new HostGlobMatcher(hostGlobs.build());
int[] allowedPortsSorted;
{
ImmutableSet<Integer> allowedPortIntSet = allowedPorts.build();
int n = allowedPortIntSet.size();
allowedPortsSorted = new int[n];
Iterator<Integer> allowedPortIt = allowedPortIntSet.iterator();
for (int i = 0; i < n; ++i) {
allowedPortsSorted[i] = allowedPortIt.next();
}
Arrays.sort(allowedPortsSorted);
}
Predicate<? super Integer> portClassifier =
allowedPortsSorted.length == 0 // No exclusion specified
? Predicates.alwaysTrue()
: Predicates.alwaysFalse();
if (this.allowedPortClassifier != null) {
portClassifier = this.allowedPortClassifier;
}
UserInfoClassifier userInfoClassifier =
this.allowedUserInfoClassifier != null
? this.allowedUserInfoClassifier
: UserInfoClassifiers.NO_PASSWORD_BUT_USERNAME_IF_ALLOWED_BY_SCHEME;
return new AuthorityClassifierImpl(
ipv4Set,
ipv6Set,
domainNameSet,
hostGlobMatcher,
matchesAnyHost,
allowedPortsSorted,
portClassifier,
userInfoClassifier);
}
示例7: all
import com.google.common.base.Predicates; //导入方法依赖的package包/类
public static Predicate<MutableModelNode> all() {
return Predicates.alwaysTrue();
}
示例8: createExtended
import com.google.common.base.Predicates; //导入方法依赖的package包/类
/** This is useful if you want to use a particular class for this property, but don't care what the class contains
* (it will never contain an incorrect value) */
public static <T extends Comparable<T>> BuildCraftExtendedProperty<T> createExtended(String name, Class clazz) {
return new BuildCraftExtendedProperty<T>(name, clazz, Predicates.<T> alwaysTrue());
}
示例9: EntityAIAvoidEntity
import com.google.common.base.Predicates; //导入方法依赖的package包/类
public EntityAIAvoidEntity(EntityCreature p_i46404_1_, Class<T> p_i46404_2_, float p_i46404_3_, double p_i46404_4_, double p_i46404_6_)
{
this(p_i46404_1_, p_i46404_2_, Predicates.<T>alwaysTrue(), p_i46404_3_, p_i46404_4_, p_i46404_6_);
}
示例10: convertCopyFrom
import com.google.common.base.Predicates; //导入方法依赖的package包/类
public CopyFromAnalyzedStatement convertCopyFrom(CopyFrom node, Analysis analysis) {
analysis.expectsAffectedRows(true);
DocTableInfo tableInfo = analysisMetaData.schemas().getWritableTable(
TableIdent.of(node.table(), analysis.parameterContext().defaultSchema()));
DocTableRelation tableRelation = new DocTableRelation(tableInfo);
// Add SQL Authentication
// GaoPan 2016/06/16
AuthResult authResult = AuthService.sqlAuthenticate(analysis.parameterContext().getLoginUserContext(),
tableInfo.ident().schema(), tableInfo.ident().name(), PrivilegeType.READ_ONLY);
if (authResult.getStatus() != RestStatus.OK) {
throw new NoPermissionException(authResult.getStatus().getStatus(), authResult.getMessage());
}
String partitionIdent = null;
if (!node.table().partitionProperties().isEmpty()) {
partitionIdent = PartitionPropertiesAnalyzer.toPartitionIdent(
tableInfo,
node.table().partitionProperties(),
analysis.parameterContext().parameters());
}
Context context = new Context(analysisMetaData, analysis.parameterContext(), tableRelation, true);
Predicate<DiscoveryNode> nodeFilters = Predicates.alwaysTrue();
Settings settings = Settings.EMPTY;
if (node.genericProperties().isPresent()) {
// copy map as items are removed. The GenericProperties map is cached in the query cache and removing
// items would cause subsequent queries that hit the cache to have different genericProperties
Map<String, Expression> properties = new HashMap<>(node.genericProperties().get().properties());
nodeFilters = discoveryNodePredicate(analysis.parameterContext().parameters(), properties.remove(NodeFilters.NAME));
settings = settingsFromProperties(properties, context.expressionAnalyzer, context.expressionAnalysisContext);
}
Symbol uri = context.processExpression(node.path());
if (!(uri.valueType() == DataTypes.STRING ||
uri.valueType() instanceof CollectionType && ((CollectionType) uri.valueType()).innerType() == DataTypes.STRING)) {
throw CopyFromAnalyzedStatement.raiseInvalidType(uri.valueType());
}
return new CopyFromAnalyzedStatement(tableInfo, settings, uri, partitionIdent, nodeFilters);
}
示例11: 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);
}
示例12: EntityAIAvoidEntity
import com.google.common.base.Predicates; //导入方法依赖的package包/类
public EntityAIAvoidEntity(EntityCreature theEntityIn, Class<T> classToAvoidIn, float avoidDistanceIn, double farSpeedIn, double nearSpeedIn)
{
this(theEntityIn, classToAvoidIn, Predicates.<T>alwaysTrue(), avoidDistanceIn, farSpeedIn, nearSpeedIn);
}
示例13: PropertyFloat
import com.google.common.base.Predicates; //导入方法依赖的package包/类
public PropertyFloat(String name)
{
this(name, Predicates.<Float>alwaysTrue());
}