|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.weborganic.uri.template.Variable
public class Variable
A variable in a URL pattern or template. Expansion rule (4.4.1):
"In a variable ('var') expansion, if the variable is defined then substitute the value of
the variable, otherwise substitute the default value.
If no default value is given then substitute with the empty string."
Characters (4.2):
var = varname [ "=" vardefault ]
vars = var [ *("," var) ]
varname = (ALPHA / DIGIT)*
(ALPHA / DIGIT / "." / "_" / "-" )
vardefault = *(unreserved / pct-encoded)
| Nested Class Summary | |
|---|---|
static class |
Variable.Reserved
Used for reserved variable names. |
| Constructor Summary | |
|---|---|
Variable(String name)
Creates a new variable. |
|
Variable(String name,
String def)
Creates a new variable. |
|
Variable(Variable.Reserved reserved)
Creates a new variable. |
|
| Method Summary | |
|---|---|
String |
defaultValue()
Returns the default value for this variable. |
boolean |
equals(Object o)
|
int |
hashCode()
|
static boolean |
isValidName(String name)
Indicates whether the variable has a valid name according to the specifications. |
static boolean |
isValidValue(String value)
Indicates whether the variable has a valid value according to the specifications. |
String |
name()
Returns the name of this variable. |
static Variable |
parse(String exp)
Parses the given expression and returns the corresponding instance. |
String |
toString()
|
String |
value(Parameters parameters)
Returns the expanded value of this variable. |
String[] |
values(Parameters parameters)
Returns the expanded value of this variable. |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Variable(Variable.Reserved reserved)
throws NullPointerException,
IllegalArgumentException
reserved - The name of the variable.
NullPointerException - If the specified name is null.
IllegalArgumentException - If the specified name is an empty string.
public Variable(String name)
throws NullPointerException,
IllegalArgumentException
name - The name of the variable.
NullPointerException - If the specified name is null.
IllegalArgumentException - If the specified name is an empty string.
public Variable(String name,
String def)
throws NullPointerException,
IllegalArgumentException
name - The name of the variable.def - The default value for the variable.
NullPointerException - If the specified name is null.
IllegalArgumentException - If the specified name is an empty string.| Method Detail |
|---|
public String name()
null.
public String defaultValue()
null.
public String value(Parameters parameters)
parameters - The parameters.
public String[] values(Parameters parameters)
parameters - The parameters.
public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object
public static Variable parse(String exp)
throws URITemplateSyntaxException
exp - The expression to parse.
URITemplateSyntaxException - If the expression cannot be parsedpublic static boolean isValidName(String name)
name - The name of the variable.
true if the name is valid; false otherwise.public static boolean isValidValue(String value)
value - The value of the variable.
true if the name is not valid; false otherwise.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||