类 MessageTool.TextKey

java.lang.Object
org.apache.velocity.tools.struts.MessageTool.TextKey
封闭类:
MessageTool

public class MessageTool.TextKey extends Object
Helper class to simplify tool usage when retrieving no-arg messages from the default bundle that have periods in their key.

So instead of $text.get("forms.profile.title"),1 you can just type $text.forms.profile.title. Also, this lets you do things like:

   #if( $text.forms.profile.exists )
      #set( $profiletext = $text.forms.profile )
      <h1>$profiletext.title</h1>
      <h3>$profiletext.subtitle</h3>
   #end
 

从以下版本开始:
VelocityTools 1.2
  • 字段详细资料

    • key

      private final String key
    • bundle

      private final String bundle
    • args

      private final Object[] args
    • locale

      private final Locale locale
  • 构造器详细资料

    • TextKey

      public TextKey(String key, String bundle, Object[] args, Locale locale)
      从以下版本开始:
      VelocityTools 1.4
  • 方法详细资料

    • get

      public MessageTool.TextKey get(String appendme)
      Appends a period and the new key to the current key and returns a new TextKey instance with the combined result as its key.
    • bundle

      public MessageTool.TextKey bundle(String setme)
      Returns a new TextKey with the specified resource bundle set.
      从以下版本开始:
      VelocityTools 1.3
    • locale

      public MessageTool.TextKey locale(Locale setme)
      Returns a new TextKey with the specified resource bundle set.
      从以下版本开始:
      VelocityTools 1.4
    • insert

      public MessageTool.TextKey insert(Object addme)
      Returns a new TextKey with the specified argument to be inserted into the text output. If arguments already exist for this TextKey, the new arguments will be appended to the old ones in the new TextKey that is returned.
      从以下版本开始:
      VelocityTools 1.3
    • insert

      public MessageTool.TextKey insert(Object addme, Object metoo)
      Returns a new TextKey with the specified arguments to be inserted into the text output. If arguments already exist for this TextKey, the new arguments will be appended to the old ones in the new TextKey that is returned.
      从以下版本开始:
      VelocityTools 1.3
    • insert

      public MessageTool.TextKey insert(Object addme, Object metoo, Object methree)
      Returns a new TextKey with the specified arguments to be inserted into the text output. If arguments already exist for this TextKey, the new arguments will be appended to the old ones in the new TextKey that is returned.
      从以下版本开始:
      VelocityTools 1.3
    • insert

      public MessageTool.TextKey insert(List addme)
      Returns a new TextKey with the specified List of arguments to be inserted into the text output. If arguments already exist for this TextKey, the new arguments will be appended to the old ones in the new TextKey that is returned.
      从以下版本开始:
      VelocityTools 1.3
    • insert

      public MessageTool.TextKey insert(Object[] addme)
      Returns a new TextKey with the specified array of arguments to be inserted into the text output. If arguments already exist for this TextKey, the new arguments will be appended to the old ones in the new TextKey that is returned.
      从以下版本开始:
      VelocityTools 1.3
    • clearArgs

      public MessageTool.TextKey clearArgs()
      This will return a new TextKey that has no arguments to be inserted into the text output.
      从以下版本开始:
      VelocityTools 1.3
    • getExists

      public boolean getExists()
      Convenience method to allow $text.key.exists syntax.
      从以下版本开始:
      VelocityTools 1.3
    • exists

      public boolean exists()
      Checks for the existence of the key that we've built up.
      从以下版本开始:
      VelocityTools 1.3
    • toString

      public String toString()
      Renders the text output according to the collected key value, bundle, and arguments.
      覆盖:
      toString 在类中 Object