org.restlet.util
Class Variable

java.lang.Object
  extended by org.restlet.util.Variable

public final class Variable
extends Object

Variable descriptor for reference templates.

Author:
Jerome Louvel (contact@noelios.com)
See Also:
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_DIGIT
          Matches all digital characters.
static int TYPE_URI_ALL
          Matches all URI characters.
static int TYPE_URI_FRAGMENT
          Matches URI fragment characters.
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, String defaultValue, boolean required, boolean fixed)
          Constructor.
 
Method Summary
 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 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_ALL

public static final int TYPE_ALL
Matches all characters.

See Also:
Constant Field Values

TYPE_ALPHA

public static final int TYPE_ALPHA
Matches all alphabetical characters.

See Also:
Constant Field Values

TYPE_ALPHA_DIGIT

public static final int TYPE_ALPHA_DIGIT
Matches all alphabetical and digital characters.

See Also:
Constant Field Values

TYPE_DIGIT

public static final int TYPE_DIGIT
Matches all digital characters.

See Also:
Constant Field Values

TYPE_URI_ALL

public static final int TYPE_URI_ALL
Matches all URI characters.

See Also:
Constant Field Values

TYPE_URI_FRAGMENT

public static final int TYPE_URI_FRAGMENT
Matches URI fragment characters.

See Also:
Constant Field Values

TYPE_URI_QUERY

public static final int TYPE_URI_QUERY
Matches URI query characters.

See Also:
Constant Field Values

TYPE_URI_SCHEME

public static final int TYPE_URI_SCHEME
Matches URI scheme characters.

See Also:
Constant Field Values

TYPE_URI_SEGMENT

public static final int TYPE_URI_SEGMENT
Matches URI segment characters.

See Also:
Constant Field Values

TYPE_URI_UNRESERVED

public static final int TYPE_URI_UNRESERVED
Matches unreserved URI characters.

See Also:
Constant Field Values

TYPE_WORD

public static final int TYPE_WORD
Matches all alphabetical and digital characters plus the underscore.

See Also:
Constant Field Values
Constructor Detail

Variable

public Variable()
Default constructor. Type is TYPE_ALL, default value is "", required is true and fixed is false.


Variable

public Variable(int type)
Constructor. Default value is "", required is true and fixed is false.

Parameters:
type - The type of variable. See TYPE_* constants.

Variable

public Variable(int type,
                String defaultValue,
                boolean required,
                boolean fixed)
Constructor.

Parameters:
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.
Method Detail

getType

public int getType()
Returns the type of variable. See TYPE_* constants.

Returns:
The type of variable. See TYPE_* constants.

getDefaultValue

public String getDefaultValue()
Returns the default value to use if the key couldn't be found in the model.

Returns:
The default value to use if the key couldn't be found in the model.

isRequired

public boolean isRequired()
Returns true if the variable is required or optional.

Returns:
True if the variable is required or optional.

isFixed

public boolean isFixed()
Returns true if the value is fixed, in which case the "defaultValue" property is always used.

Returns:
True if the value is fixed, in which case the "defaultValue" property is always used.


Copyright © 2005-2007 Noelios Consulting.