Package org.apache.wiki.parser
Class LinkParser.Link
- java.lang.Object
- 
- org.apache.wiki.parser.LinkParser.Link
 
- 
- Enclosing class:
- LinkParser
 
 public static class LinkParser.Link extends java.lang.Object Inner class serving as a struct containing the parsed components of a link.
- 
- 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(org.jdom2.Attribute attr)Adds another attribute to the link.intattributeCount()Returns the number of attributes on this link.java.util.Iterator<org.jdom2.Attribute>getAttributes()Returns an Iterator over the list of JDOM Attributes.java.lang.StringgetExternalWiki()Returns the name of the wiki if this is an interwiki link.java.lang.StringgetExternalWikiPage()Returns the wikiname part of an interwiki link.java.lang.StringgetReference()Returns the link reference, or the link text if null.java.lang.StringgetText()Returns the link text.booleanhasReference()Returns true, if there is a reference.booleanisInterwikiLink()Returns true, if this Link represents an InterWiki link (of the form wiki:page).protected voidsetReference(java.lang.String ref)Sets the hypertext reference.protected voidsetText(java.lang.String text)Sets the link text.java.lang.StringtoString()Returns a wikitext string representation of this Link.
 
- 
- 
- 
Constructor Detail- 
Linkprotected Link(java.lang.String text) throws ParseException Create a new Link with text but no reference.- Parameters:
- text- The link text.
- Throws:
- ParseException- If the link text is illegal.
 
 - 
Linkprotected Link(java.lang.String text, java.lang.String ref) throws ParseException Create a new link with a given text and hyperlink (reference).- Parameters:
- text- The link text.
- ref- The hypertext reference.
- Throws:
- ParseException- If the link text or reference are illegal.
 
 
- 
 - 
Method Detail- 
setTextprotected void setText(java.lang.String text) throws ParseException Sets the link text.- Parameters:
- text- The link text.
- Throws:
- ParseException- If the text is illegal (e.g. null).
 
 - 
getTextpublic java.lang.String getText() Returns the link text.- Returns:
- Link text.
 
 - 
setReferenceprotected void setReference(java.lang.String ref) throws ParseException Sets the hypertext reference. Typically, this is an URI or an interwiki link, or a wikilink.- Parameters:
- ref- The reference.
- Throws:
- ParseException- If the reference is illegal.
 
 - 
hasReferencepublic boolean hasReference() Returns true, if there is a reference.- Returns:
- True, if there's a reference; false otherwise.
 
 - 
getReferencepublic java.lang.String getReference() Returns the link reference, or the link text if null.- Returns:
- A link reference.
 
 - 
isInterwikiLinkpublic boolean isInterwikiLink() Returns true, if this Link represents an InterWiki link (of the form wiki:page).- Returns:
- True, if this Link represents an InterWiki link.
 
 - 
getExternalWikipublic java.lang.String getExternalWiki() Returns the name of the wiki if this is an interwiki link.Link link = new Link("Foo","Wikipedia:Foobar"); assert( link.getExternalWikiPage(), "Wikipedia" );- Returns:
- Name of the wiki, or null, if this is not an interwiki link.
 
 - 
getExternalWikiPagepublic java.lang.String getExternalWikiPage() Returns the wikiname part of an interwiki link. Used only with interwiki links.Link link = new Link("Foo","Wikipedia:Foobar"); assert( link.getExternalWikiPage(), "Foobar" );- Returns:
- Wikiname part, or null, if this is not an interwiki link.
 
 - 
attributeCountpublic int attributeCount() Returns the number of attributes on this link.- Returns:
- The number of attributes.
 
 - 
addAttributepublic void addAttribute(org.jdom2.Attribute attr) Adds another attribute to the link.- Parameters:
- attr- A JDOM Attribute.
 
 - 
getAttributespublic java.util.Iterator<org.jdom2.Attribute> getAttributes() Returns an Iterator over the list of JDOM Attributes.- Returns:
- Iterator over the attributes.
 
 - 
toStringpublic java.lang.String toString() Returns a wikitext string representation of this Link.- Overrides:
- toStringin class- java.lang.Object
- Returns:
- WikiText.
 
 
- 
 
-