net.sf.doolin.util.expression
Class Expression

java.lang.Object
  extended by net.sf.doolin.util.expression.Expression
Direct Known Subclasses:
BusExpression

public class Expression
extends Object

A Expression is basically a text string whose content can be created from bundle keys or properties in a bean model.

Tokens that are used are:

Author:
Damien Coraboeuf

Constructor Summary
Expression(Locale locale, Object context, String pattern)
          Parses the expression
Expression(Locale locale, String text)
          Builds an expression with a fixed text.
Expression(Object context, String pattern)
          Parses the expression
Expression(String text)
          Builds an expression with a fixed text and for the default locale
 
Method Summary
protected  void evaluate()
          Internal method used to evaluate the value of the expression.
 String getValue()
          Gets the value for the expression
 boolean isVariable()
          Checks if the expression contains parts which can vary according to the model.
protected  void setValue(String newValue)
          Internal method that sets a new value to the expression
 String toString()
           
protected  void visitTokensWith(TokenVisitor visitor)
          Visits a the whole token tree with a visitor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Expression

public Expression(Locale locale,
                  Object context,
                  String pattern)
Parses the expression

Parameters:
locale - Locale for the expression
context - Context object
pattern - Pattern used to build the expression

Expression

public Expression(Locale locale,
                  String text)
Builds an expression with a fixed text.

Parameters:
locale - Locale for this expression
text - Fixed value for this expression (not parsed)

Expression

public Expression(Object context,
                  String pattern)
Parses the expression

Parameters:
context - Context object
pattern - Pattern used to build the expression

Expression

public Expression(String text)
Builds an expression with a fixed text and for the default locale

Parameters:
text - Fixed text (not parsed)
See Also:
Locale.getDefault()
Method Detail

evaluate

protected void evaluate()
Internal method used to evaluate the value of the expression.


getValue

public String getValue()
Gets the value for the expression

Returns:
Value

isVariable

public boolean isVariable()
Checks if the expression contains parts which can vary according to the model.

Returns:
true if some parts of the expression are dependent on the model.

setValue

protected void setValue(String newValue)
Internal method that sets a new value to the expression

Parameters:
newValue - New value

toString

public String toString()
Overrides:
toString in class Object

visitTokensWith

protected void visitTokensWith(TokenVisitor visitor)
Visits a the whole token tree with a visitor.

Parameters:
visitor - Visitor to apply for each token.


Copyright © 2011. All Rights Reserved.