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 thearticle
record component.final boolean
Indicates whether some other object is "equal to" this one.static WikiLinkTarget
from
(String wholeLink, List<WikiLinkNamespaceComponent> namespaceComponents, String article, Optional<String> section) Creates a wikilink targetfinal int
hashCode()
Returns a hash code value for this object.boolean
Returns the value of theisCategory
record component.language()
Returns the value of thelanguage
record component.section()
Returns the value of thesection
record component.final String
toString()
Returns a string representation of this record class.Returns the value of thewholeLink
record component.wiki()
Returns the value of thewiki
record component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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 aWikiLinkTarget
record class.- Parameters:
wholeLink
- the value for thewholeLink
record componentwiki
- the value for thewiki
record componentlanguage
- the value for thelanguage
record componentarticle
- the value for thearticle
record componentsection
- the value for thesection
record componentisCategory
- the value for theisCategory
record 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 thewholeLink
record component.- Returns:
- the value of the
wholeLink
record component
-
wiki
Returns the value of thewiki
record component.- Returns:
- the value of the
wiki
record component
-
language
Returns the value of thelanguage
record component.- Returns:
- the value of the
language
record component
-
article
Returns the value of thearticle
record component.- Returns:
- the value of the
article
record component
-
section
Returns the value of thesection
record component.- Returns:
- the value of the
section
record component
-
isCategory
public boolean isCategory()Returns the value of theisCategory
record component.- Returns:
- the value of the
isCategory
record component
-