/** * Adds a filter to the walked paths. * * @param pathFilter the filter. {@code pathFilter} returns {@code true} if the path should be * accepted and {@code false} otherwise. * @return this */ public DirectoryWalker filter(Predicate<Path> pathFilter) { this.pathFilter = this.pathFilter.and(pathFilter); return this; }
@Override public Predicate<T> and(Predicate<? super T> other) { return this.delegate.and(other); }
@Override public Predicate<T> and(Predicate<? super T> other) { return this.delegate.and(other); }
/** * Exclude all the databases that the given predicate tests as true for. * @param databases the databases to excluded * @return */ public Builder excludeDatabases(Predicate<String> databases) { this.dbFilter = this.dbFilter.and(databases.negate()); return this; }
/** * Exclude all the tables that the given predicate tests as true for. * @param tables the tables to be excluded. * @return this */ public Builder excludeTables(Predicate<TableId> tables) { this.tableFilter = this.tableFilter.and(tables.negate()); return this; }
public Builder and(Predicate<ServerWebExchange> predicate) { Assert.notNull(this.predicate, "can not call and() on null predicate"); this.predicate = this.predicate.and(predicate); return this; }
ScoreEntityIterator filter( Predicate<ScoreEntry> predicate ) { if ( this.predicate != null ) { predicate = this.predicate.and( predicate ); } return new ScoreEntityIterator( iterator, predicate ); }
private Predicate<Field> isSharedContainer() { return isContainer().and(ReflectionUtils::isStatic); }
private Predicate<Field> isRestartContainer() { return isContainer().and(ReflectionUtils::isNotStatic); }
@Test public void createWithGeneratedDatabaseName() throws Exception { Predicate<String> urlPredicate = (url) -> url.startsWith("jdbc:hsqldb:mem:"); urlPredicate.and((url) -> !url.endsWith("dataSource")); urlPredicate.and((url) -> !url.endsWith("shouldBeOverriddenByGeneratedName")); assertCorrectSetupForSingleDataSource("jdbc-config-db-name-generated.xml", urlPredicate); }
private void buildErrorRecordingPredicate() { this.errorRecordingPredicate = getRecordingPredicate() .and(buildIgnoreExceptionsPredicate() .orElse(DEFAULT_RECORD_FAILURE_PREDICATE)); }
private void buildExceptionPredicate() { this.exceptionPredicate = getRetryPredicate() .and(buildIgnoreExceptionsPredicate() .orElse(DEFAULT_RECORD_FAILURE_PREDICATE)); }
/** * A method creates the {@link Predicate} which is able to filter all Jersey meta-providers along with the components which * is able to register the current used {@link InjectionManager}. * * @param injectionManager current injection manager. * @return {@code Predicate} excluding Jersey meta-providers and the specific ones for a current {@code InjectionManager}. */ public static Predicate<ContractProvider> excludeMetaProviders(InjectionManager injectionManager) { return EXCLUDE_META_PROVIDERS.and(model -> !injectionManager.isRegistrable(model.getImplementationClass())); }
/** * A method creates the {@link Predicate} which is able to filter all Jersey meta-providers along with the components which * is able to register the current used {@link InjectionManager}. * * @param injectionManager current injection manager. * @return {@code Predicate} excluding Jersey meta-providers and the specific ones for a current {@code InjectionManager}. */ public static Predicate<ContractProvider> excludeMetaProviders(InjectionManager injectionManager) { return EXCLUDE_META_PROVIDERS.and(model -> !injectionManager.isRegistrable(model.getImplementationClass())); }
@Override public Persister<ENTITY> persister(HasLabelSet<ENTITY> includedFields) { Predicate<Column> columns = insertColumnFilter.and(c -> includedFields.test(c.getId())); String statement = getInsertStatement(updateColumnFilter.and(c12 -> includedFields.test(c12.getId()))); return entity -> persist(entity, f -> columns.test(columnsByFields.get(f)), statement); }
@Override public Updater<ENTITY> updater(HasLabelSet<ENTITY> includedFields) { assertHasPrimaryKeyColumns(); Predicate<Column> columns = updateColumnFilter.and(c -> includedFields.test(c.getId())); String statement = getUpdateStatement(updateColumnFilter.and(c12 -> includedFields.test(c12.getId()))); return entity -> update(entity, f -> columns.test(columnsByFields.get(f)), statement); }
private Set<String> getSessions(Flag... flags) { Locality locality = new CacheLocality(this.cache); try (Stream<Key<String>> keys = this.cache.getAdvancedCache().withFlags(flags).keySet().stream()) { return keys.filter(this.filter.and(key -> locality.isLocal(key))).map(key -> key.getValue()).collect(Collectors.toSet()); } }
@DataBoundConstructor public Plugin(String sourceId, JSONObject o) { super(sourceId, o, UpdateSite.this.url); this.wiki = get(o,"wiki"); this.title = get(o,"title"); this.excerpt = get(o,"excerpt"); this.compatibleSinceVersion = Util.intern(get(o,"compatibleSinceVersion")); this.minimumJavaVersion = Util.intern(get(o, "minimumJavaVersion")); this.requiredCore = Util.intern(get(o,"requiredCore")); this.categories = o.has("labels") ? internInPlace((String[])o.getJSONArray("labels").toArray(EMPTY_STRING_ARRAY)) : null; JSONArray ja = o.getJSONArray("dependencies"); int depCount = (int)(ja.stream().filter(IS_DEP_PREDICATE.and(IS_NOT_OPTIONAL)).count()); int optionalDepCount = (int)(ja.stream().filter(IS_DEP_PREDICATE.and(IS_NOT_OPTIONAL.negate())).count()); dependencies = getPresizedMutableMap(depCount); optionalDependencies = getPresizedMutableMap(optionalDepCount); for(Object jo : o.getJSONArray("dependencies")) { JSONObject depObj = (JSONObject) jo; // Make sure there's a name attribute and that the optional value isn't true. String depName = Util.intern(get(depObj,"name")); if (depName!=null) { if (get(depObj, "optional").equals("false")) { dependencies.put(depName, Util.intern(get(depObj, "version"))); } else { optionalDependencies.put(depName, Util.intern(get(depObj, "version"))); } } } }
public static Predicate<MethodInsnNode> mount(final ClassLoader loader, final String owner) { Signature use1 = new Signature(loader, owner, "use", Jooby.class); Signature use2 = new Signature(loader, owner, "use", String.class , Jooby.class); return is(MethodInsnNode.class).and(m -> { return use1.matches(m) || use2.matches(m); }); }