Class TokenExpression

  • All Implemented Interfaces:
    TokenEvaluator
    Direct Known Subclasses:
    ItemExpression

    public class TokenExpression
    extends java.lang.Object
    implements TokenEvaluator
    The Class TokenExpression.

    Created: 2008. 03. 29 AM 12:59:16

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Activity activity  
    • Constructor Summary

      Constructors 
      Constructor Description
      TokenExpression​(Activity activity)
      Instantiates a new token expression parser.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object evaluate​(Token token)  
      java.lang.Object evaluate​(Token[] tokens)  
      void evaluate​(Token[] tokens, java.io.Writer writer)  
      java.util.List<java.lang.Object> evaluateAsList​(java.util.List<Token[]> tokensList)  
      java.util.Map<java.lang.String,​java.lang.Object> evaluateAsMap​(java.util.Map<java.lang.String,​Token[]> tokensMap)  
      java.util.Properties evaluateAsProperties​(java.util.Properties tokensProp)  
      java.util.Set<java.lang.Object> evaluateAsSet​(java.util.Set<Token[]> tokensSet)  
      java.lang.String evaluateAsString​(Token[] tokens)  
      protected java.lang.Object getAttribute​(Token token)
      Returns the value of the named attribute as an Object of the activity's request attributes or action results.
      protected java.lang.Object getBean​(Token token)
      Returns the bean instance that matches the given token.
      protected java.lang.Object getBeanProperty​(java.lang.Object bean, java.lang.String propertyName)
      Invoke bean's property.
      protected FileParameter getFileParameter​(java.lang.String name)
      Returns a FileParameter object as a given activity's request parameter name, or null if the parameter does not exist.
      protected FileParameter[] getFileParameterValues​(java.lang.String name)
      Returns an array of FileParameter objects containing all of the values the given activity's request parameter has, or null if the parameter does not exist.
      protected java.lang.String getParameter​(java.lang.String name)
      Returns the value of an activity's request parameter as a String, or null if the parameter does not exist.
      protected java.lang.String[] getParameterValues​(java.lang.String name)
      Returns an array of String objects containing all of the values the given activity's request parameter has, or null if the parameter does not exist.
      protected java.lang.Object getProperty​(Token token)
      Returns an Environment variable that matches the given token.
      protected java.lang.String getTemplate​(Token token)
      Executes template, returns the generated output.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • activity

        protected final Activity activity
    • Constructor Detail

      • TokenExpression

        public TokenExpression​(Activity activity)
        Instantiates a new token expression parser.
        Parameters:
        activity - the current Activity
    • Method Detail

      • evaluate

        public void evaluate​(Token[] tokens,
                             java.io.Writer writer)
                      throws java.io.IOException
        Specified by:
        evaluate in interface TokenEvaluator
        Throws:
        java.io.IOException
      • evaluateAsList

        public java.util.List<java.lang.Object> evaluateAsList​(java.util.List<Token[]> tokensList)
        Specified by:
        evaluateAsList in interface TokenEvaluator
      • evaluateAsSet

        public java.util.Set<java.lang.Object> evaluateAsSet​(java.util.Set<Token[]> tokensSet)
        Specified by:
        evaluateAsSet in interface TokenEvaluator
      • evaluateAsMap

        public java.util.Map<java.lang.String,​java.lang.Object> evaluateAsMap​(java.util.Map<java.lang.String,​Token[]> tokensMap)
        Specified by:
        evaluateAsMap in interface TokenEvaluator
      • evaluateAsProperties

        public java.util.Properties evaluateAsProperties​(java.util.Properties tokensProp)
        Specified by:
        evaluateAsProperties in interface TokenEvaluator
      • getParameter

        protected java.lang.String getParameter​(java.lang.String name)
        Returns the value of an activity's request parameter as a String, or null if the parameter does not exist.
        Parameters:
        name - a String specifying the name of the parameter
        Returns:
        a String representing the single value of the parameter
      • getParameterValues

        protected java.lang.String[] getParameterValues​(java.lang.String name)
        Returns an array of String objects containing all of the values the given activity's request parameter has, or null if the parameter does not exist.
        Parameters:
        name - a String specifying the name of the parameter
        Returns:
        an array of String objects containing the parameter's values
      • getFileParameter

        protected FileParameter getFileParameter​(java.lang.String name)
        Returns a FileParameter object as a given activity's request parameter name, or null if the parameter does not exist.
        Parameters:
        name - a String specifying the name of the parameter
        Returns:
        a FileParameter representing the single value of the parameter
      • getFileParameterValues

        protected FileParameter[] getFileParameterValues​(java.lang.String name)
        Returns an array of FileParameter objects containing all of the values the given activity's request parameter has, or null if the parameter does not exist.
        Parameters:
        name - a String specifying the name of the parameter
        Returns:
        an array of FileParameter objects containing the parameter's values
      • getAttribute

        protected java.lang.Object getAttribute​(Token token)
        Returns the value of the named attribute as an Object of the activity's request attributes or action results.
        Parameters:
        token - the token
        Returns:
        an Object containing the value of the attribute, or null if the attribute does not exist
      • getBean

        protected java.lang.Object getBean​(Token token)
        Returns the bean instance that matches the given token.
        Parameters:
        token - the token
        Returns:
        an instance of the bean
      • getBeanProperty

        protected java.lang.Object getBeanProperty​(java.lang.Object bean,
                                                   java.lang.String propertyName)
        Invoke bean's property.
        Parameters:
        bean - the bean object
        propertyName - the property name
        Returns:
        the object
      • getProperty

        protected java.lang.Object getProperty​(Token token)
                                        throws java.io.IOException
        Returns an Environment variable that matches the given token.
           %{classpath:/com/aspectran/sample.properties}
           %{classpath:/com/aspectran/sample.properties^propertyName:defaultValue}
         
        Parameters:
        token - the token
        Returns:
        an environment variable
        Throws:
        java.io.IOException - if an I/O error has occurred
      • getTemplate

        protected java.lang.String getTemplate​(Token token)
        Executes template, returns the generated output.
        Parameters:
        token - the token
        Returns:
        the generated output as String