|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.util.Variable
public final class Variable
Variable descriptor for reference templates.
Template
Field Summary | |
---|---|
static int |
TYPE_ALL
Matches all characters. |
static int |
TYPE_ALPHA
Matches all alphabetical characters. |
static int |
TYPE_ALPHA_DIGIT
Matches all alphabetical and digital characters. |
static int |
TYPE_COMMENT
Matches any TEXT excluding "(" and ")". |
static int |
TYPE_COMMENT_ATTRIBUTE
Matches any TEXT inside a comment excluding ";". |
static int |
TYPE_DIGIT
Matches all digital characters. |
static int |
TYPE_TOKEN
Matches any CHAR except CTLs or separators. |
static int |
TYPE_URI_ALL
Matches all URI characters. |
static int |
TYPE_URI_FRAGMENT
Matches URI fragment characters. |
static int |
TYPE_URI_PATH
Matches URI path characters (not the query or the fragment parts). |
static int |
TYPE_URI_QUERY
Matches URI query characters. |
static int |
TYPE_URI_SCHEME
Matches URI scheme characters. |
static int |
TYPE_URI_SEGMENT
Matches URI segment characters. |
static int |
TYPE_URI_UNRESERVED
Matches unreserved URI characters. |
static int |
TYPE_WORD
Matches all alphabetical and digital characters plus the underscore. |
Constructor Summary | |
---|---|
Variable()
Default constructor. |
|
Variable(int type)
Constructor. |
|
Variable(int type,
java.lang.String defaultValue,
boolean required,
boolean fixed)
Constructor. |
|
Variable(int type,
java.lang.String defaultValue,
boolean required,
boolean fixed,
boolean decodedOnParse,
boolean encodedOnFormat)
Constructor. |
Method Summary | |
---|---|
java.lang.String |
encode(java.lang.String value)
According to the type of the variable, encodes the value given in parameters. |
java.lang.String |
getDefaultValue()
Returns the default value to use if the key couldn't be found in the model. |
int |
getType()
Returns the type of variable. |
boolean |
isDecodedOnParse()
Indicates if the parsed value must be decoded. |
boolean |
isEncodedOnFormat()
Indicates if the formatted value must be encoded. |
boolean |
isFixed()
Returns true if the value is fixed, in which case the "defaultValue" property is always used. |
boolean |
isRequired()
Returns true if the variable is required or optional. |
void |
setDecodedOnParse(boolean decodedOnParse)
Indicates if the parsed value must be decoded. |
void |
setDefaultValue(java.lang.String defaultValue)
Sets the default value to use if the key couldn't be found in the model. |
void |
setEncodedOnFormat(boolean encodedOnFormat)
Indicates if the formatted value must be encoded. |
void |
setFixed(boolean fixed)
Indicates if the value is fixed |
void |
setRequired(boolean required)
Indicates if the variable is required or optional. |
void |
setType(int type)
Sets the type of variable. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int TYPE_ALL
public static final int TYPE_ALPHA
public static final int TYPE_ALPHA_DIGIT
public static final int TYPE_COMMENT
public static final int TYPE_COMMENT_ATTRIBUTE
public static final int TYPE_DIGIT
public static final int TYPE_TOKEN
public static final int TYPE_URI_ALL
public static final int TYPE_URI_FRAGMENT
public static final int TYPE_URI_PATH
public static final int TYPE_URI_QUERY
public static final int TYPE_URI_SCHEME
public static final int TYPE_URI_SEGMENT
public static final int TYPE_URI_UNRESERVED
public static final int TYPE_WORD
Constructor Detail |
---|
public Variable()
public Variable(int type)
type
- The type of variable. See TYPE_* constants.public Variable(int type, java.lang.String defaultValue, boolean required, boolean fixed)
type
- The type of variable. See TYPE_* constants.defaultValue
- The default value to use if the key couldn't be found in the
model.required
- Indicates if the variable is required or optional.fixed
- Indicates if the value is fixed, in which case the
"defaultValue" property is always used.public Variable(int type, java.lang.String defaultValue, boolean required, boolean fixed, boolean decodedOnParse, boolean encodedOnFormat)
type
- The type of variable. See TYPE_* constants.defaultValue
- The default value to use if the key couldn't be found in the
model.required
- Indicates if the variable is required or optional.fixed
- Indicates if the value is fixed, in which case the
"defaultValue" property is always used.decodedOnParse
- Indicates if the parsed value must be decoded.encodedOnFormat
- Indicates if the formatted value must be encoded.Method Detail |
---|
public java.lang.String encode(java.lang.String value)
value
- The value to encode.
public java.lang.String getDefaultValue()
public int getType()
public boolean isDecodedOnParse()
public boolean isEncodedOnFormat()
public boolean isFixed()
public boolean isRequired()
public void setDecodedOnParse(boolean decodedOnParse)
decodedOnParse
- True if the parsed value must be decoded, false otherwise.public void setDefaultValue(java.lang.String defaultValue)
defaultValue
- The default value to use if the key couldn't be found in the
model.public void setEncodedOnFormat(boolean encodedOnFormat)
encodedOnFormat
- True if the formatted value must be encoded, false otherwise.public void setFixed(boolean fixed)
fixed
- True if the value is fixedpublic void setRequired(boolean required)
required
- True if the variable is required or optional.public void setType(int type)
type
- The type of variable.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |