public class TokenOperatorD3 extends Object implements TokenOperator
op = 1*ALPHA
arg = *(reserved / unreserved / pct-encoded)
var = varname [ "=" vardefault ]
vars = var [ *("," var) ]
varname = (ALPHA / DIGIT)*(ALPHA / DIGIT / "." / "_" / "-" )
vardefault = *(unreserved / pct-encoded)
operator = "-" op "|" arg "|" vars
| Modifier and Type | Class and Description |
|---|---|
static class |
TokenOperatorD3.Operator
The list of operators currently supported.
|
| Constructor and Description |
|---|
TokenOperatorD3(TokenOperatorD3.Operator op,
String arg,
List<Variable> vars)
Creates a new operator token.
|
| Modifier and Type | Method and Description |
|---|---|
String |
argument()
Returns the argument part of this token.
|
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.
|
TokenOperatorD3.Operator |
operator()
Returns the operator part of this token.
|
static TokenOperatorD3 |
parse(String exp)
Parses the specified string and returns the corresponding token.
|
boolean |
resolve(String expanded,
Map<Variable,Object> values)
Resolves the specified expanded URI part for this token.
|
protected static String |
strip(String exp)
Removes the curly brackets from the specified expression.
|
static TokenOperatorD3.Operator |
toOperator(String op)
Returns the operator if it is defined in this class.
|
String |
toString() |
protected static List<Variable> |
toVariables(String exp)
Returns the variables for a given expression containing a list of variables.
|
List<Variable> |
variables()
Returns the list of variables used in this token.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitexpression, isResolvablepublic TokenOperatorD3(TokenOperatorD3.Operator op, String arg, List<Variable> vars) throws NullPointerException
op - The operator to use.arg - The argument for this operator.vars - The variables for this operator.NullPointerException - If any of the argument is null.public String expand(Parameters parameters)
expand in interface Expandableparameters - The parameters for variable substitution.public TokenOperatorD3.Operator operator()
public String argument()
public List<Variable> variables()
variables in interface TokenOperatorpublic static TokenOperatorD3.Operator toOperator(String op)
op - The string representation of an operator.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.
public static TokenOperatorD3 parse(String exp) throws URITemplateSyntaxException
exp - The expression to parse.URITemplateSyntaxException - If the string cannot be parsed as a validpublic 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 Tokentrue if variables can be resolved from the specified pattern;
false otherwise.public String expression()
expression in interface Tokenpublic boolean equals(Object o)
protected static final String strip(String exp)
The - expression to 'strip'.protected static final List<Variable> toVariables(String exp) throws URITemplateSyntaxException
exp - An expression containing a comma separated list of variables.URITemplateSyntaxException - If thrown by the Variable parse method.Copyright © 2021. All rights reserved.