Refine search
@Override public Set<SchemaObjectType> getSchemaObjectTypes() { return asSet(SchemaObjectType.INDEX); }
public GemFireComponentClassTypeScanner withIncludes(Iterable<TypeFilter> includes) { stream(nullSafeIterable(includes).spliterator(), false).forEach(this.includes::add); return this; } }
/** * Returns a {@link Map} of application domain object field names to {@link Analyzer Analyzers} used in * the construction of the {@link LuceneIndex Lucene Indexes} for each field. * * @return a {@link Map} of fields names to {@link Analyzer Analyzers}. * @see org.apache.lucene.analysis.Analyzer * @see java.util.Map * @see #getFields() */ protected Map<String, Analyzer> getFieldAnalyzers() { return nullSafeMap(this.fieldAnalyzers); }
public void setRegionNames(Iterable<String> regionNames) { this.regionNames = CollectionUtils.addAll(this.regionNames, nullSafeIterable(regionNames)); }
private boolean isNamedRegion(String beanName, BeanDefinition beanDefinition, ConfigurableListableBeanFactory beanFactory) { return CollectionUtils.isEmpty(regionNames) || CollectionUtils.containsAny(regionNames, resolveBeanNames(beanName, beanDefinition, beanFactory)); }
@Nullable public static SchemaObjectDefiner compose(Iterable<SchemaObjectDefiner> schemaObjectDefiners) { Set<SchemaObjectDefiner> schemaObjectDefinerSet = stream(nullSafeIterable(schemaObjectDefiners).spliterator(), false) .filter(Objects::nonNull).collect(Collectors.toSet()); return (schemaObjectDefinerSet.isEmpty() ? null : (schemaObjectDefinerSet.size() == 1 ? schemaObjectDefinerSet.iterator().next() : new ComposableSchemaObjectDefiner(schemaObjectDefinerSet))); }
private String toCommaDelimitedHostAndPortsString(List<InetSocketAddress> socketAddresses) { return StringUtils.collectionToCommaDelimitedString(nullSafeList(socketAddresses).stream() .filter(Objects::nonNull) .map(socketAddress -> String.format("%1$s:%2$d", socketAddress.getHostName(), socketAddress.getPort())) .collect(Collectors.toList())); } }
private Set<EnableSsl.Component> resolveComponents(AnnotationAttributes annotationAttributes) { Set<EnableSsl.Component> components = Arrays.stream(Optional.of(resolveProperty(sslProperty("components"), "")) .filter(StringUtils::hasText) .map(StringUtils::commaDelimitedListToStringArray) .orElseGet(() -> new String[0])) .map(EnableSsl.Component::valueOfName) .collect(Collectors.toSet()); components = components.isEmpty() ? CollectionUtils.asSet((EnableSsl.Component[]) annotationAttributes.get("components")) : components; components = components.isEmpty() ? Collections.singleton(EnableSsl.Component.ALL) : components; return components; }
@Override public Collection<T> findAllById(Iterable<ID> ids) { List<ID> keys = Streamable.of(ids).stream().collect(StreamUtils.toUnmodifiableList()); return CollectionUtils.<ID, T>nullSafeMap(this.template.getAll(keys)).values().stream() .filter(Objects::nonNull).collect(Collectors.toList()); }
private Set<Region> onlyClientRegions(Set<Region> regions) { return nullSafeSet(regions).stream().filter(RegionUtils::isClient).collect(Collectors.toSet()); } }
private List<IndexConfigurer> resolveIndexConfigurers() { return Optional.ofNullable(this.indexConfigurers) .filter(indexConfigurers -> !indexConfigurers.isEmpty()) .orElseGet(() -> Optional.of(getBeanFactory()) .filter(beanFactory -> beanFactory instanceof ListableBeanFactory) .map(beanFactory -> { Map<String, IndexConfigurer> beansOfType = ((ListableBeanFactory) beanFactory) .getBeansOfType(IndexConfigurer.class, true, false); return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList()); }) .orElseGet(Collections::emptyList) ); }
new CopyOnWriteArrayList<>(nullSafeSet(baseRegionAttributes.getAsyncEventQueueIds())); new CopyOnWriteArrayList<>(nullSafeSet(baseRegionAttributes.getGatewaySenderIds())); nullSafeArray(invocation.getArgument(0), CacheListener.class); Arrays.stream(cacheListenersArgument).forEach(it -> Assert.notNull(it, "The CacheListener[] must not contain null elements")); .thenAnswer(invocation -> asSet(asyncEventQueueIds.toArray(new String[asyncEventQueueIds.size()]))); .thenAnswer(invocation -> asSet(gatewaySenderIds.toArray(new String[gatewaySenderIds.size()])));
protected OffHeapBeanFactoryPostProcessor(Set<String> regionNames) { this.regionNames = CollectionUtils.nullSafeSet(regionNames); }
/** * Returns a {@link List} of application domain object fields to be indexed. * * @return a {@link List} of application domain object fields to be indexed. * @see #getFieldAnalyzers() * @see java.util.List */ protected List<String> getFields() { return nullSafeList(this.fields); }
public static FileFilter and(Iterable<FileFilter> fileFilters) { FileFilter current = null; for (FileFilter fileFilter : nullSafeIterable(fileFilters)) { current = compose(current, LogicalOperator.AND, fileFilter); } return current; }
for (ZipEntry entry : CollectionUtils.iterable(zipFile.entries())) {
protected boolean hasProperties(Properties properties) { return !CollectionUtils.isEmpty(properties); }
/** * A null-safe operation returning the original Iterable object if non-null or a default, empty Iterable * implementation if null. * * @param <T> the class type of the iterable elements. * @param iterable the Iterable object evaluated for a null reference. * @return the Iterable object if not null or a default, empty Iterable implementation otherwise. * @see #emptyIterable() * @see java.lang.Iterable */ @NonNull public static <T> Iterable<T> nullSafeIterable(@Nullable Iterable<T> iterable) { return iterable != null ? iterable : emptyIterable(); }
@Nullable public static SchemaObjectCollector<?> compose(Iterable<SchemaObjectCollector<?>> schemaObjectCollectors) { List<SchemaObjectCollector<?>> schemaObjectCollectorList = stream(nullSafeIterable(schemaObjectCollectors).spliterator(), false) .filter(Objects::nonNull).collect(Collectors.toList()); return (schemaObjectCollectorList.isEmpty() ? null : (schemaObjectCollectorList.size() == 1 ? schemaObjectCollectorList.iterator().next() : new ComposableSchemaObjectCollector(schemaObjectCollectorList))); }
private Set<EnableSsl.Component> resolveComponents(AnnotationAttributes annotationAttributes) { Set<EnableSsl.Component> components = Arrays.stream(Optional.of(resolveProperty(sslProperty("components"), "")) .filter(StringUtils::hasText) .map(StringUtils::commaDelimitedListToStringArray) .orElseGet(() -> new String[0])) .map(EnableSsl.Component::valueOfName) .collect(Collectors.toSet()); components = components.isEmpty() ? CollectionUtils.asSet((EnableSsl.Component[]) annotationAttributes.get("components")) : components; components = components.isEmpty() ? Collections.singleton(EnableSsl.Component.ALL) : components; return components; }