Package org.terracotta.context.query
Class Matchers
java.lang.Object
org.terracotta.context.query.Matchers
A static library of
Matcher implementations that can be used with the
QueryBuilder.filter(Matcher) method.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Matcher<T>Returns a matcher that matches when against objects which match all of the supplied matchers.static <T> Matcher<T>Returns a matcher that matches when against objects which match any of the supplied matchers.static Matcher<ContextElement>attributes(Matcher<Map<String, Object>> matcher) Returns a matcher that matches context elements whoseContextElement.attributes()match against the supplied matcher.context(Matcher<ContextElement> matcher) Returns a matcher that matches tree nodes whoseTreeNode.getContext()match against the supplied matcher.hasAttribute(String key, Object value) Returns a matcher that matches attribute maps that include the given attribute entry.hasAttribute(String key, Matcher<? extends Object> value) Returns a matcher that matches attribute maps the include an attribute with the given name, and whose value matches the given matcher.static Matcher<ContextElement>identifier(Matcher<Class<?>> matcher) Returns a matcher that matches context elements whoseContextElement.identifier()match against the supplied matcher.static <T> Matcher<T>subclassOf(Class<?> klazz) Returns a matcher that matches classes that are sub-types of the supplied class.
-
Constructor Details
-
Matchers
private Matchers()
-
-
Method Details
-
context
Returns a matcher that matches tree nodes whoseTreeNode.getContext()match against the supplied matcher.- Parameters:
matcher-ContextElementmatcher- Returns:
- a
TreeNodematcher
-
attributes
Returns a matcher that matches context elements whoseContextElement.attributes()match against the supplied matcher.- Parameters:
matcher- aMap(attributes) matcher- Returns:
- a
ContextElementmatcher
-
identifier
Returns a matcher that matches context elements whoseContextElement.identifier()match against the supplied matcher.- Parameters:
matcher-Class<?>matcher- Returns:
- a
ContextElementmatcher
-
subclassOf
Returns a matcher that matches classes that are sub-types of the supplied class.- Parameters:
klazz- a potential super-type- Returns:
- a
Class<?>matcher
-
hasAttribute
Returns a matcher that matches attribute maps that include the given attribute entry.- Parameters:
key- attribute namevalue- attribute value- Returns:
- a
Map<String, Object>matcher
-
hasAttribute
Returns a matcher that matches attribute maps the include an attribute with the given name, and whose value matches the given matcher.- Parameters:
key- attribute namevalue- attribute value matcher- Returns:
- a
Map<String, Object>matcher
-
anyOf
Returns a matcher that matches when against objects which match any of the supplied matchers.- Type Parameters:
T- type of the object to be matched- Parameters:
matchers- list of matchers to match- Returns:
- a compound matcher
-
allOf
Returns a matcher that matches when against objects which match all of the supplied matchers.- Type Parameters:
T- type of the object to be matched- Parameters:
matchers- list of matchers to match- Returns:
- a compound matcher
-
not
-