com.xpn.xwiki.content.parsers
Interface ReplaceLinkHandler

All Known Implementing Classes:
RenamePageReplaceLinkHandler

public interface ReplaceLinkHandler

Decides what strategy to use when replacing wiki links. Namely decides when two links are equal and what the replacement link will be. This is because there can different strategy when comparing links: for example are 2 links the same if they have different aliases or different query strings?

Version:
$Id: d9b85008796619f5f06651d9f420f1e2a2e14156 $

Method Summary
 boolean compare(Link linkToLookFor, Link linkToReplace)
          Compare 2 links.
 Link getReplacementLink(Link newLink, Link linkToReplace)
          Compute the link that will be used to replace matching links in the parsed content.
 

Method Detail

compare

boolean compare(Link linkToLookFor,
                Link linkToReplace)
Compare 2 links.

Parameters:
linkToLookFor - the link to look for
linkToReplace - the link to replace
Returns:
true if the 2 links are the same of false otherwise

getReplacementLink

Link getReplacementLink(Link newLink,
                        Link linkToReplace)
Compute the link that will be used to replace matching links in the parsed content. This is useful for example to implement a strategy where you only want to replace the space and page names but keep the existing alias, target, query string, etc.

Parameters:
newLink - the link to use to replace the matched link. It's possible that only some fields are set and the replacement algorithm will compute what the others fields should be
linkToReplace - the link to be replaced
Returns:
the link to use for replacing the linkToReplace link


Copyright © 2004-2013 XWiki. All Rights Reserved.