org.weborganic.furi
Class TokenFactory

java.lang.Object
  extended by org.weborganic.furi.TokenFactory

public class TokenFactory
extends Object

A factory for URI tokens.

Tokens can be instantiated from an expression which is specific to each token.

Version:
6 November 2009
Author:
Christophe Lauret
See Also:
TokenLiteral, TokenVariable, TokenOperatorD3, TokenOperatorPS

Nested Class Summary
static class TokenFactory.Syntax
          A syntax to use for creating tokens.
 
Method Summary
static TokenFactory getInstance()
          Returns a token factory instance using the default syntax (DRAFTX).
static TokenFactory getInstance(TokenFactory.Syntax syntax)
          Returns a token factory instance.
 Token newToken(String exp)
          Generates the token corresponding to the specified expression.
static Token newToken(String exp, TokenFactory.Syntax syntax)
          Generates the token corresponding to the specified expression.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newToken

public Token newToken(String exp)
Generates the token corresponding to the specified expression.

Parameters:
exp - The expression.
Returns:
The corresponding token instance.
Throws:
URITemplateSyntaxException - If the expression could not be parsed as a valid token.

newToken

public static Token newToken(String exp,
                             TokenFactory.Syntax syntax)
Generates the token corresponding to the specified expression.

Parameters:
exp - The expression.
Returns:
The corresponding token instance.
Throws:
URITemplateSyntaxException - If the expression could not be parsed as a valid token.

getInstance

public static TokenFactory getInstance()
Returns a token factory instance using the default syntax (DRAFTX).

Returns:
a token factory instance using the default syntax (DRAFTX).

getInstance

public static TokenFactory getInstance(TokenFactory.Syntax syntax)
Returns a token factory instance.

Returns:
a token factory instance.