Package org.getalp.dbnary.wiki
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
-
-
Field Summary
-
Fields inherited from class org.getalp.dbnary.wiki.WikiText.Token
offset
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
accept(Visitor<T> visitor)
protected void
addToken(WikiText.Token t)
WikiText.Template
asTemplate()
Map<String,WikiText.WikiContent>
cloneArgs()
return a MUTABLE clone of argName/argValue Map.Map<String,String>
cloneParsedArgs()
return a MUTABLE clone of argName/argValue Map.void
fillText(StringBuilder r)
WikiText.WikiContent
getArg(String key)
get the WikiContent value of the requested argument key.LinkedHashMap<String,WikiText.WikiContent>
getArgs()
return the argName/argValue Map.WikiText.WikiContent
getContent()
String
getName()
String
getParsedArg(String key)
get the String value of the requested argument key.String
getParsedArg(String key, String defaultValue)
get the String value of the requested argument key, or return default value if argument value is null.Map<String,String>
getParsedArgs()
return the IMMUTABLE argName/argValue Map.protected void
setEndOffset(int position)
sets the end offset to the given position (should point to the first char of the closing "}}")-
Methods inherited from class org.getalp.dbnary.wiki.WikiText.Token
addFlattenedTokens, asExternalLink, asHeading, asHTMLComment, asIndentation, asIndentedItem, asInternalLink, asItem, asLink, asListItem, asNoWiki, asNumberedListItem, asText, asWikiContent, asWikiSection, getBeginIndex, getEndIndex, getFullContent, getText, getWikiText, toString
-
-
-
-
Method Detail
-
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 classWikiText.Token
- Parameters:
position
- the position of the first character of the enclosing "}}"
-
addToken
protected void addToken(WikiText.Token t)
- Specified by:
addToken
in classWikiText.Token
-
fillText
public void fillText(StringBuilder r)
- Specified by:
fillText
in classWikiText.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 retrieveddefaultValue
- the default value returned if the argument is undefined- Returns:
- the value of the argument or defaultValue
-
getArgs
public LinkedHashMap<String,WikiText.WikiContent> 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 classWikiText.Token
-
-