T
- The class of the target.public class BindingMatch<T> extends Object
This class holds the result of a BindingSet.match(URI)
operation. It contains methods to inspect the
groups captured during matching, where a group is defined as a sequence of characters matches by a wildcard
in the UriPattern
, and to retrieve the matched target.
Modifier and Type | Field and Description |
---|---|
private UriPattern.Match |
match |
private UriPattern |
matched |
private T |
target |
Constructor and Description |
---|
BindingMatch(UriPattern.Match match,
T target)
Deprecated.
use BindingMatch(UriPattern.Match match, T target, UriPattern matched)
|
BindingMatch(UriPattern.Match match,
T target,
UriPattern matched)
Constructs a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
String |
group(int idx)
Returns the input subsequence captured by the given group by this match.
|
int |
groupCount()
Returns the number of captured groups of this match.
|
UriPattern |
matched()
Returns the URI pattern that was matched.
|
T |
target()
Returns the matched target.
|
private final UriPattern.Match match
private final T target
private final UriPattern matched
@Deprecated public BindingMatch(UriPattern.Match match, T target)
Constructs a new instance of this class.
match
- The match information for this instance.target
- The target of this match.NullPointerException
- If any argument is null.public BindingMatch(UriPattern.Match match, T target, UriPattern matched)
Constructs a new instance of this class.
match
- The match information for this instance.target
- The target of this match.matched
- The matched URI patternNullPointerException
- If any argument is null.public int groupCount()
Returns the number of captured groups of this match. Any non-negative integer smaller than the value returned by this method is a valid group index for this match.
public String group(int idx)
Returns the input subsequence captured by the given group by this match. Groups are indexed from left to right, starting at zero. Note that some groups may match an empty string, in which case this method returns the empty string. This method never returns null.
idx
- The index of the group to return.IndexOutOfBoundsException
- If there is no group in the match with the given index.public T target()
Returns the matched target.
public UriPattern matched()
Returns the URI pattern that was matched.
Copyright © 2017. All rights reserved.