Record Class WikiLinkTarget
java.lang.Object
java.lang.Record
com.lucaskjaerozhang.wikitext_parser.ast.link.WikiLinkTarget
- Record Components:
wholeLink- What the user actually typed for the link.wiki- A wiki for cross wiki linking.language- A link to the article in a different language.article- The article that's being linked tosection- A section of the page we're linking to.
- All Implemented Interfaces:
WikiTextElement
public record WikiLinkTarget(String wholeLink, Optional<String> wiki, Optional<String> language, String article, Optional<String> section, boolean isCategory)
extends Record
implements WikiTextElement
Wiki links look like [[wiki:language:article#section|display]], and the first half before the
pipe is the target.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionarticle()Returns the value of thearticlerecord component.final booleanIndicates whether some other object is "equal to" this one.static WikiLinkTargetfrom(String wholeLink, List<WikiLinkNamespaceComponent> namespaceComponents, String article, Optional<String> section) Creates a wikilink targetfinal inthashCode()Returns a hash code value for this object.booleanReturns the value of theisCategoryrecord component.language()Returns the value of thelanguagerecord component.section()Returns the value of thesectionrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thewholeLinkrecord component.wiki()Returns the value of thewikirecord component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.lucaskjaerozhang.wikitext_parser.ast.base.WikiTextElement
getCategories
-
Constructor Details
-
WikiLinkTarget
public WikiLinkTarget(String wholeLink, Optional<String> wiki, Optional<String> language, String article, Optional<String> section, boolean isCategory) Creates an instance of aWikiLinkTargetrecord class.- Parameters:
wholeLink- the value for thewholeLinkrecord componentwiki- the value for thewikirecord componentlanguage- the value for thelanguagerecord componentarticle- the value for thearticlerecord componentsection- the value for thesectionrecord componentisCategory- the value for theisCategoryrecord component
-
-
Method Details
-
from
public static WikiLinkTarget from(String wholeLink, List<WikiLinkNamespaceComponent> namespaceComponents, String article, Optional<String> section) Creates a wikilink target- Parameters:
wholeLink- The whole text for the link. This is used for un-named links.namespaceComponents- The namespace components that locate the article to link.article- The article name we're linking to, with no namespace components.section- An optional section to link to within the article.- Returns:
- A WikiLinkTarget node
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
wholeLink
Returns the value of thewholeLinkrecord component.- Returns:
- the value of the
wholeLinkrecord component
-
wiki
Returns the value of thewikirecord component.- Returns:
- the value of the
wikirecord component
-
language
Returns the value of thelanguagerecord component.- Returns:
- the value of the
languagerecord component
-
article
Returns the value of thearticlerecord component.- Returns:
- the value of the
articlerecord component
-
section
Returns the value of thesectionrecord component.- Returns:
- the value of the
sectionrecord component
-
isCategory
public boolean isCategory()Returns the value of theisCategoryrecord component.- Returns:
- the value of the
isCategoryrecord component
-