Package org.wildfly.discovery
Class FilterSpec
java.lang.Object
org.wildfly.discovery.FilterSpec
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AllFilterSpec,AnyFilterSpec,BooleanFilterSpec,EqualsFilterSpec,GreaterEqualFilterSpec,HasFilterSpec,LessEqualFilterSpec,NotFilterSpec,SubstringFilterSpec
A filter specification for matching attributes.
- Author:
- David M. Lloyd
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFilterSpec.Visitor<P,R, E extends Exception> A visitor for filter spec traversal. -
Method Summary
Modifier and TypeMethodDescriptionfinal <R,E extends Exception>
Raccept(FilterSpec.Visitor<?, R, E> visitor) abstract <P,R, E extends Exception>
Raccept(FilterSpec.Visitor<P, R, E> visitor, P parameter) static FilterSpecall()Create a filter which matches everything.static FilterSpecall(Collection<FilterSpec> specs) Create a filter which matches all of the given sub-filters.static FilterSpecall(FilterSpec... specs) Create a filter which matches all of the given sub-filters.static FilterSpecany(Collection<FilterSpec> specs) Create a filter which matches any of the given sub-filters.static FilterSpecany(FilterSpec... specs) Create a filter which matches any of the given sub-filters.static FilterSpecCreate a filter specification which approximately matches one attribute value.static FilterSpecCreate a filter specification which matches one attribute value.static FilterSpecCreate a filter specification which matches one attribute value.final booleanabstract booleanequals(FilterSpec other) static StringEscape an attribute string, suitable for putting into a filter.static voidescapeTo(String str, StringBuilder b) Escape an attribute string, suitable for putting into a filter.static FilterSpecfromString(String string) Create a new filter from a string.static FilterSpecgreaterOrEqual(String attribute, byte[] value) Create a filter specification which matches when the given attribute's value is lexicographically greater than or equal to the given value.static FilterSpecgreaterOrEqual(String attribute, String value) Create a filter specification which matches when the given attribute's value is lexicographically greater than or equal to the given value.static FilterSpechasAttribute(String attribute) Create a filter specification which matches when the given attribute is present.static FilterSpeclessOrEqual(String attribute, byte[] value) Create a filter specification which matches when the given attribute's value is lexicographically less than or equal to the given value.static FilterSpeclessOrEqual(String attribute, String value) Create a filter specification which matches when the given attribute's value is lexicographically less than or equal to the given value.abstract booleanmatchesMulti(Map<String, ? extends Collection<AttributeValue>> attributes) Determine whether the given attribute multi-map matches this filter.abstract booleanmatchesSimple(Map<String, AttributeValue> attributes) Determine whether the given simple attribute map matches this filter.abstract booleanmayMatch(Collection<String> attributeNames) Determine whether this filter spec might match an attribute map containing the given keys.abstract booleanmayNotMatch(Collection<String> attributeNames) Determine whether this filter spec might not match an attribute map containing the given keys.static FilterSpecnone()Create a filter which matches nothing.static FilterSpecnot(FilterSpec spec) Create a filter which matches the inverse of the given filter.static FilterSpecsubstringMatch(String attribute, String initialPart, String finalPart) Create a filter specification which matches a leading or trailing (or both) substring of one attribute value.final StringtoString()Get the string representation of this filter.final booleanwillMatch(Collection<String> attributeNames) Determine whether this filter spec will always match an attribute map containing the given keys.final booleanwillNotMatch(Collection<String> attributeNames) Determine whether this filter spec will never match an attribute map containing the given keys.
-
Method Details
-
matchesSimple
Determine whether the given simple attribute map matches this filter.- Parameters:
attributes- the attribute map- Returns:
trueif the map matches,falseotherwise
-
matchesMulti
Determine whether the given attribute multi-map matches this filter.- Parameters:
attributes- the attribute map- Returns:
trueif the map matches,falseotherwise
-
willMatch
Determine whether this filter spec will always match an attribute map containing the given keys. This is simply the inverse ofmayNotMatch(Collection).- Parameters:
attributeNames- the attribute names- Returns:
trueif the filter will definitely match,falseif it might not match
-
mayMatch
Determine whether this filter spec might match an attribute map containing the given keys.- Parameters:
attributeNames- the attribute names- Returns:
trueif the filter spec might match,falseif it will definitely not match
-
mayNotMatch
Determine whether this filter spec might not match an attribute map containing the given keys.- Parameters:
attributeNames- the attribute names- Returns:
trueif the filter spec might not match,falseif it will definitely match
-
willNotMatch
Determine whether this filter spec will never match an attribute map containing the given keys. This is simply the inverse ofmayMatch(Collection).- Parameters:
attributeNames- the attribute names- Returns:
trueif the filter will definitely not match,falseif it might match
-
accept
public abstract <P,R, R acceptE extends Exception> (FilterSpec.Visitor<P, R, throws EE> visitor, P parameter) - Throws:
E extends Exception
-
accept
- Throws:
E extends Exception
-
fromString
Create a new filter from a string.- Parameters:
string- the filter string- Returns:
- the filter specification
-
all
Create a filter which matches everything.- Returns:
- the filter specification
-
none
Create a filter which matches nothing.- Returns:
- the filter specification
-
all
Create a filter which matches all of the given sub-filters.- Parameters:
specs- the sub-filters- Returns:
- the filter specification
-
all
Create a filter which matches all of the given sub-filters.- Parameters:
specs- the sub-filters- Returns:
- the filter specification
-
any
Create a filter which matches any of the given sub-filters.- Parameters:
specs- the sub-filters- Returns:
- the filter specification
-
any
Create a filter which matches any of the given sub-filters.- Parameters:
specs- the sub-filters- Returns:
- the filter specification
-
not
Create a filter which matches the inverse of the given filter.- Parameters:
spec- the sub-filter- Returns:
- the filter specification
-
equal
Create a filter specification which matches one attribute value.- Parameters:
attribute- the attribute namevalue- the attribute value- Returns:
- the filter specification
-
equal
Create a filter specification which matches one attribute value.- Parameters:
attribute- the attribute namevalue- the attribute byte value- Returns:
- the filter specification
-
substringMatch
Create a filter specification which matches a leading or trailing (or both) substring of one attribute value.- Parameters:
attribute- the attribute nameinitialPart- the initial part, or""to match any initial partfinalPart- the final part, or""to match any final part- Returns:
- the filter specification
-
approx
Create a filter specification which approximately matches one attribute value.- Parameters:
attribute- the attribute namevalue- the attribute value- Returns:
- the filter specification
-
greaterOrEqual
Create a filter specification which matches when the given attribute's value is lexicographically greater than or equal to the given value.- Parameters:
attribute- the attribute namevalue- the attribute value- Returns:
- the filter specification
-
greaterOrEqual
Create a filter specification which matches when the given attribute's value is lexicographically greater than or equal to the given value.- Parameters:
attribute- the attribute namevalue- the attribute value- Returns:
- the filter specification
-
lessOrEqual
Create a filter specification which matches when the given attribute's value is lexicographically less than or equal to the given value.- Parameters:
attribute- the attribute namevalue- the attribute value- Returns:
- the filter specification
-
lessOrEqual
Create a filter specification which matches when the given attribute's value is lexicographically less than or equal to the given value.- Parameters:
attribute- the attribute namevalue- the attribute value- Returns:
- the filter specification
-
hasAttribute
Create a filter specification which matches when the given attribute is present.- Parameters:
attribute- the attribute name- Returns:
- the filter specification
-
escape
Escape an attribute string, suitable for putting into a filter.- Parameters:
str- the string to escape- Returns:
- the escaped string
-
escapeTo
Escape an attribute string, suitable for putting into a filter.- Parameters:
str- the string to escapeb- the builder to append to
-
equals
-
equals
-
toString
Get the string representation of this filter.
-