org.weborganic.furi
Interface Token

All Superinterfaces:
Expandable
All Known Subinterfaces:
TokenOperator
All Known Implementing Classes:
TokenLiteral, TokenOperatorD3, TokenOperatorDX, TokenOperatorPS, TokenVariable

public interface Token
extends Expandable

Defines a token in a URI pattern or template.

All tokens can be represented as a text expression which cannot be null.

Two tokens having the same expression are considered equal.

Version:
30 December 2008
Author:
Christophe Lauret

Method Summary
 String expression()
          The expression corresponding to this token.
 boolean isResolvable()
          Indicates whether this token can be resolved.
 boolean resolve(String expanded, Map<Variable,Object> values)
          Resolves the specified expanded URI part for this token.
 
Methods inherited from interface org.weborganic.furi.Expandable
expand
 

Method Detail

expression

String expression()
The expression corresponding to this token.

Returns:
The expression corresponding to this token.

isResolvable

boolean isResolvable()
Indicates whether this token can be resolved.

A resolvable token contains variables which can be resolved.

Returns:
true if variables can be resolved from the specified pattern; false otherwise.

resolve

boolean resolve(String expanded,
                Map<Variable,Object> values)
Resolves the specified expanded URI part for this token.

The resolution process requires all variables referenced in the token to be mapped to the value that is present in the expanded URI data.

Parameters:
expanded - The part of the URI that correspond to an expanded version of the token.
values - The variables mapped to their values as a result of resolution.
Returns:
true this operation was successful; false otherwise.