public class PropertyMatchers extends ArrayList<PropertyMatcher> implements Predicate<Properties>
PropertyMatcher
to perform tests/replace on
all of them at once.modCount
Constructor and Description |
---|
PropertyMatchers() |
Modifier and Type | Method and Description |
---|---|
void |
addAll(PropertyMatcher... matchers)
Adds one or more property matchers.
|
Properties |
match(Properties properties)
Returns a new instance that is a subset of the given properties,
containing only keys and matching values.
|
boolean |
matches(Properties properties)
Returns
true if any of the properties key and values
match any of the property matchers. |
int |
remove(String field)
Removes all matchers for a given field.
|
Properties |
replace(Properties properties,
String replacement)
Returns properties that were replaced (or empty).
|
boolean |
test(Properties properties)
For compatibility with
Predicate . |
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
equals, hashCode
containsAll, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
containsAll, equals, hashCode
parallelStream, stream
public void addAll(PropertyMatcher... matchers)
matchers
- property matcherspublic int remove(String field)
field
- the field to remove matchers onpublic boolean matches(Properties properties)
true
if any of the properties key and values
match any of the property matchers.properties
- the properties to look for a matchtrue
if at least one value for the key matches
the list of matcher regular expressionspublic boolean test(Properties properties)
Predicate
. Same as invoking
matches(Properties)
.test
in interface Predicate<Properties>
properties
- the properties to look for a matchtrue
if at least one value for the key matches
the list of matcher regular expressionspublic Properties match(Properties properties)
properties
- the properties to look for a matchtest(Properties)
public Properties replace(Properties properties, String replacement)
properties
- the properties to look for a match and replacereplacement
- text replacementCopyright © 2008–2023 Norconex Inc.. All rights reserved.