Class TokenEvaluation

java.lang.Object
com.aspectran.core.context.expr.TokenEvaluation
All Implemented Interfaces:
TokenEvaluator
Direct Known Subclasses:
ItemEvaluation

public class TokenEvaluation extends Object implements TokenEvaluator
The Class TokenEvaluation.

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

  • Field Details

    • activity

      protected final Activity activity
  • Constructor Details

    • TokenEvaluation

      public TokenEvaluation(Activity activity)
      Instantiates a new TokenEvaluation.
      Parameters:
      activity - the current Activity
  • Method Details

    • getActivity

      public Activity getActivity()
      Specified by:
      getActivity in interface TokenEvaluator
    • evaluate

      public Object evaluate(Token token)
      Specified by:
      evaluate in interface TokenEvaluator
    • evaluate

      public Object evaluate(Token[] tokens)
      Specified by:
      evaluate in interface TokenEvaluator
    • evaluate

      public void evaluate(Token[] tokens, Writer writer) throws IOException
      Specified by:
      evaluate in interface TokenEvaluator
      Throws:
      IOException
    • evaluateAsString

      public String evaluateAsString(Token[] tokens)
      Specified by:
      evaluateAsString in interface TokenEvaluator
    • evaluateAsList

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

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

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

      public Properties evaluateAsProperties(Properties tokensProp)
      Specified by:
      evaluateAsProperties in interface TokenEvaluator
    • getParameter

      protected String getParameter(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 String[] getParameterValues(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(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(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 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 Object getBean(@NonNull Token token)
      Returns the bean instance that matches the given token.
      Parameters:
      token - the token
      Returns:
      an instance of the bean
    • getBeanProperty

      protected Object getBeanProperty(Object bean, String propertyName)
      Return the value of the specified property of the specified bean.
      Parameters:
      bean - the bean object
      propertyName - the property name
      Returns:
      the object
    • getProperty

      protected Object getProperty(@NonNull Token token) throws 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:
      IOException - if an I/O error has occurred
    • getTemplate

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