Package org.xwiki.rendering.wikimodel
Class WikiReferenceParser
- java.lang.Object
-
- org.xwiki.rendering.wikimodel.WikiReferenceParser
-
- All Implemented Interfaces:
IWikiReferenceParser
- Direct Known Subclasses:
CreoleWikiReferenceParser
,GWikiWikiReferenceParser
,JspWikiReferenceParser
,XWikiReferenceParser
public class WikiReferenceParser extends Object implements IWikiReferenceParser
This class is used as a common parser of references. It is used to transform references found in wiki documents into corresponding structured objects -WikiReference
. Methods of this class should be overloaded to parse correctly wiki-specific references.- Since:
- 4.0M1
- Version:
- $Id: a5ef2bec0f1cb1eae766ffdc7459675f905050a0 $
- See Also:
WikiReference
-
-
Constructor Summary
Constructors Constructor Description WikiReferenceParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
getLabel(String[] chunks)
Extracts the label from the array of chunks and returns it.protected String
getLink(String[] chunks)
Extracts the link from the array of chunks and returns it.protected WikiParameters
getParameters(String[] chunks)
Extracts parameters part of the original reference and returns it as a WikiParameters.WikiReference
parse(String str)
Parses the given reference, recognizes individual parts of this reference (link, label, parameters) and returns the corresponding reference object.protected String[]
splitToChunks(String str)
Returns the given string split to individual segments
-
-
-
Method Detail
-
getLabel
protected String getLabel(String[] chunks)
Extracts the label from the array of chunks and returns it.- Parameters:
chunks
- the array of chunks- Returns:
- a label extracted from the given array of chunks
-
getLink
protected String getLink(String[] chunks)
Extracts the link from the array of chunks and returns it.- Parameters:
chunks
- the array of chunks- Returns:
- a link extracted from the given array of chunks
-
getParameters
protected WikiParameters getParameters(String[] chunks)
Extracts parameters part of the original reference and returns it as a WikiParameters.- Parameters:
chunks
- the array of chunks- Returns:
- the parameters
-
parse
public WikiReference parse(String str)
Description copied from interface:IWikiReferenceParser
Parses the given reference, recognizes individual parts of this reference (link, label, parameters) and returns the corresponding reference object.- Specified by:
parse
in interfaceIWikiReferenceParser
- Parameters:
str
- the reference to parse- Returns:
- a wiki reference corresponding to the given link
- See Also:
IWikiReferenceParser.parse(java.lang.String)
-
-