public class TagFilter extends Object
Tagged
items, filtering matching Tagged items from a set of candidates.
Tagged item.When a Tagged item is filtered, the following checks are made for each tag specified in the filter:
Because advanced tag usage can sometimes be unintuitive, the tag filtering logic has a built-in log which can explain why a candidate item did or did not match a particular set of filters.
| Modifier and Type | Class and Description |
|---|---|
static class |
TagFilter.Result |
| Constructor and Description |
|---|
TagFilter(String filterSpec)
Create a new tag filter.
|
| Modifier and Type | Method and Description |
|---|---|
Map<String,String> |
getMap() |
protected TagFilter.Result |
matches(Map<String,String> tags)
Although this method could early-exit for certain conditions, the full tag matching logic
is allowed to complete in order to present more complete diagnostic information back
to the user.
|
TagFilter.Result |
matchesMap(Map<String,String> tags) |
boolean |
matchesTagged(Tagged item) |
TagFilter.Result |
matchesTaggedResult(Tagged item) |
public static TagFilter MATCH_ALL
public TagFilter(String filterSpec)
All of the following forms are acceptable for a filter spec:
That is, you can use spaces or commas between tag (name,value) pairs, and you can also use colons or equals between the actual tag names and values. This is not to support mixed formatting, but it does allow for some flexibility when integrating with other formats. Extra spaces between (name,value) pairs are ignored.
As well, you can include regex patterns in your tag filter values. You can also use single quotes to guard against
However, the following forms are not acceptable for a tag spec:
filterSpec - a filter spec as explained in the javadocprotected TagFilter.Result matches(Map<String,String> tags)
tags - The tags associated with a Tagged item.public TagFilter.Result matchesMap(Map<String,String> tags)
public TagFilter.Result matchesTaggedResult(Tagged item)
public boolean matchesTagged(Tagged item)
Copyright © 2017. All rights reserved.