org.xwiki.rendering.wikimodel
Class WikiReferenceParser

java.lang.Object
  extended by org.xwiki.rendering.wikimodel.WikiReferenceParser
All Implemented Interfaces:
IWikiReferenceParser
Direct Known Subclasses:
CreoleWikiReferenceParser, GWikiWikiReferenceParser, JspWikiReferenceParser, MediaWikiReferenceParser, 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
WikiReferenceParser()
           
 
Method Summary
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WikiReferenceParser

public WikiReferenceParser()
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 interface IWikiReferenceParser
Parameters:
str - the reference to parse
Returns:
a wiki reference corresponding to the given link
See Also:
IWikiReferenceParser.parse(java.lang.String)

splitToChunks

protected String[] splitToChunks(String str)
Returns the given string split to individual segments

Parameters:
str - the string to split
Returns:
the given string split to individual segments


Copyright © 2004–2014 XWiki. All rights reserved.