public final class URIPattern extends URITemplate implements Matchable
Instances of this class implement the PageSeeder URL pattern as defined by the "PageSeeder URI Templates" document.
A PageSeeder URI Pattern follows the URI syntax defined for URI templates but must only contain matchable tokens.
Constructor and Description |
---|
URIPattern(String template)
Creates a new URI Pattern instance from the specified URI template string.
|
URIPattern(URITemplate template)
Creates a new URI Pattern instance from an existing URI Template.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
int |
hashCode() |
static boolean |
isMatchable(URITemplate template)
Indicates whether the given URI template can be used to construct a new URI Pattern instance.
|
boolean |
match(String uri)
Indicates whether this URI Pattern matches the specified URL.
|
Pattern |
pattern()
Returns the regular expression pattern corresponding to this URI pattern.
|
protected int |
score()
Returns the score for this URI pattern.
|
public URIPattern(String template)
template
- The string following the URI template syntax.IllegalArgumentException
- If the string provided does not follow the proper syntax.public URIPattern(URITemplate template)
template
- The URI template to generate the pattern from.IllegalArgumentException
- If the string provided does not follow the proper syntax.public static boolean isMatchable(URITemplate template)
A template is matchable only if all its components are matchable tokens, that is the token
implements the Matchable
interface.
template
- The template to test.true
if the template is matchable; false
otherwise.public boolean match(String uri)
public Pattern pattern()
public boolean equals(Object o)
equals
in class URITemplate
public int hashCode()
hashCode
in class URITemplate
protected int score()
Copyright © 2016 Allette Systems. All rights reserved.