Class WikiText.Template

java.lang.Object
org.getalp.dbnary.wiki.WikiText.Token
org.getalp.dbnary.wiki.WikiText.Template
All Implemented Interfaces:
Visitable
Enclosing class:
WikiText

public final class WikiText.Template extends WikiText.Token
  • Method Details

    • setEndOffset

      protected void setEndOffset(int position)
      sets the end offset to the given position (should point to the first char of the closing "}}")
      Overrides:
      setEndOffset in class WikiText.Token
      Parameters:
      position - the position of the first character of the enclosing "}}"
    • addToken

      protected void addToken(WikiText.Token t)
      Specified by:
      addToken in class WikiText.Token
    • fillText

      public void fillText(StringBuilder r)
      Specified by:
      fillText in class WikiText.Token
    • getName

      public String getName()
    • getParsedArgs

      public Map<String,String> getParsedArgs()
      return the IMMUTABLE argName/argValue Map. argName being a String and argValue a String.

      When iterated, the map will provide values or entries in insertion order, hence iterating over the map will give args in the order they were defined.

      Returns:
      the argName/argVal map
    • cloneParsedArgs

      public Map<String,String> cloneParsedArgs()
      return a MUTABLE clone of argName/argValue Map. argName being a String and argValue a String.

      When iterated, the map will provide values or entries in insertion order, hence iterating over the map will give args in the order they were defined.

      Returns:
      the argName/argVal map
    • getParsedArg

      public String getParsedArg(String key)
      get the String value of the requested argument key. If the argument contain wiki tokens, the source text is returned. Use getArgs if you want to get the WikiContent associated to the key.
      Parameters:
      key - the key of the argument to be retrieved
      Returns:
      the value of the argument or null if the argument was not specified
    • getParsedArg

      public String getParsedArg(String key, String defaultValue)
      get the String value of the requested argument key, or return default value if argument value is null. If the argument contain wiki tokens, the source text is returned. Use getArgs if you want to get the WikiContent associated to the key.
      Parameters:
      key - the key of the argument to be retrieved
      defaultValue - the default value returned if the argument is undefined
      Returns:
      the value of the argument or defaultValue
    • getArgs

      return the argName/argValue Map. argName being a String and argValue a WikiContent. When iterated, the map will provide values or entries in insertion order, hence iterating over the map will give args in the order they were defined.
      Returns:
      the argName/argVal map
    • cloneArgs

      public Map<String, WikiText.WikiContent> cloneArgs()
      return a MUTABLE clone of argName/argValue Map. argName being a String and argValue a String.

      When iterated, the map will provide values or entries in insertion order, hence iterating over the map will give args in the order they were defined.

      Returns:
      the argName/argVal map
    • getArg

      public WikiText.WikiContent getArg(String key)
      get the WikiContent value of the requested argument key.
      Parameters:
      key - the key of the argument to be retrieved
      Returns:
      the value of the argument or null if the argument was not specified
    • getContent

      public WikiText.WikiContent getContent()
    • accept

      public <T> T accept(Visitor<T> visitor)
    • asTemplate

      public WikiText.Template asTemplate()
      Overrides:
      asTemplate in class WikiText.Token