java.lang.Object
org.wikidata.wdtk.datamodel.implementation.TermImpl
All Implemented Interfaces:
MonolingualTextValue, Value

public class TermImpl extends Object implements MonolingualTextValue
Jackson representation of MonolingualTextValue data used in labels, aliases, and descriptions in JSON. Note that this is distinct from the JSON representation for property values of type MonolingualTextValue, which is implemented in MonolingualTextValueImpl.
Author:
Fredo Erxleben, Antonin Delpeuch
  • Constructor Details

    • TermImpl

      public TermImpl(String languageCode, String text)
      Create a new object from the given data.
      Parameters:
      languageCode - the language code of the value
      text - the text content of the value
    • TermImpl

      public TermImpl(MonolingualTextValue other)
      Copy constructor. This constructor is useful for converting from MonolingualTextValueImpl.
      Parameters:
      other - monolingual text value to copy
  • Method Details

    • accept

      public <T> T accept(ValueVisitor<T> valueVisitor)
      Description copied from interface: Value
      Accept a ValueVisitor and return its output.
      Specified by:
      accept in interface Value
      Parameters:
      valueVisitor - the ValueVisitor
      Returns:
      output of the visitor
    • getText

      public String getText()
      Description copied from interface: MonolingualTextValue
      Get the text of this value.
      Specified by:
      getText in interface MonolingualTextValue
      Returns:
      a string
    • getLanguageCode

      public String getLanguageCode()
      Description copied from interface: MonolingualTextValue
      Get the language code of this value. The codes are usually based on the codes used internally in Wikibase, which in turn are the codes used in the Universal Language Selector extension. However, the data model as such does not restrict the strings that might be used here.
      Specified by:
      getLanguageCode in interface MonolingualTextValue
      Returns:
      a string that represents language
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object