|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.weborganic.furi.TokenOperatorPS
public class TokenOperatorPS
A token based on the operators used in PageSeeder.
This syntax borrows heavily from a suggestion made by Roy T. Fielding on the W3C URI list and regarding the URI Template draft specification.
instruction = "{" [ operator ] variable-list "}" operator = "/" / "+" / ";" / "?" / op-reserve variable-list = varspec *( "," varspec ) varspec = [ var-type ] varname [ ":" prefix-len ] [ "=" default ] var-type = "@" / "%" / type-reserve varname = ALPHA *( ALPHA | DIGIT | "_" ) prefix-len = 1*DIGIT default = *( unreserved / reserved ) op-reserve = <anything else that isn't ALPHA or operator> type-reserve = <anything else that isn't ALPHA, ",", or operator>
Nested Class Summary | |
---|---|
static class |
TokenOperatorPS.Operator
The list of operators currently supported. |
Constructor Summary | |
---|---|
TokenOperatorPS(TokenOperatorPS.Operator op,
List<Variable> vars)
Creates a new operator token. |
|
TokenOperatorPS(TokenOperatorPS.Operator op,
Variable var)
Creates a new operator token for one variable only. |
Method Summary | |
---|---|
boolean |
equals(Object o)
Two tokens are equals if and only if their string expression is equal. |
String |
expand(Parameters parameters)
Expands the token operator using the specified parameters. |
String |
expression()
The expression corresponding to this token. |
int |
hashCode()
|
boolean |
isResolvable()
Indicates whether this token can be resolved. |
boolean |
match(String part)
Indicates whether this token matches the specified part of a URL. |
TokenOperatorPS.Operator |
operator()
Returns the operator part of this token. |
static TokenOperatorPS |
parse(String exp)
Parses the specified string and returns the corresponding token. |
Pattern |
pattern()
Returns a regular expression pattern corresponding to this object. |
boolean |
resolve(String expanded,
Map<Variable,Object> values)
Resolves the specified expanded URI part for this token. |
static TokenOperatorPS.Operator |
toOperator(char c)
Returns the operator if it is defined in this class. |
String |
toString()
|
List<Variable> |
variables()
Returns the list of variables used in this token. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.weborganic.furi.Token |
---|
expression |
Constructor Detail |
---|
public TokenOperatorPS(TokenOperatorPS.Operator op, Variable var) throws NullPointerException
op
- The operator to use.var
- The variable for this operator.
NullPointerException
- If any of the argument is null
.public TokenOperatorPS(TokenOperatorPS.Operator op, List<Variable> vars) throws NullPointerException
op
- The operator to use.vars
- The variables for this operator.
NullPointerException
- If any of the argument is null
.Method Detail |
---|
public String expand(Parameters parameters)
expand
in interface Expandable
parameters
- The parameters for variable substitution.
public TokenOperatorPS.Operator operator()
public List<Variable> variables()
variables
in interface TokenOperator
public boolean isResolvable()
A resolvable token contains variables which can be resolved. By default a token is resolvable if it can be matched.
isResolvable
in interface Token
true
if variables can be resolved from the specified pattern;
false
otherwise.public boolean resolve(String expanded, Map<Variable,Object> values)
The resolution process requires all variables referenced in the token to be mapped to the value that is present in the expanded URI data.
resolve
in interface Token
expanded
- The part of the URI that correspond to an expanded version of the token.values
- The variables mapped to their values as a result of resolution.
true
this operation was successful; false
otherwise.public boolean match(String part)
match
in interface Matchable
part
- The part of URL to test for matching.
true
if it matches; false
otherwise.public Pattern pattern()
pattern
in interface Matchable
public static TokenOperatorPS.Operator toOperator(char c)
c
- The character representation of the operator.
public static TokenOperatorPS parse(String exp) throws URITemplateSyntaxException
exp
- The expression to parse.
URITemplateSyntaxException
- If the string cannot be parsed as a validpublic String expression()
expression
in interface Token
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |