Record Class HoconTokenizer.Token

java.lang.Object
java.lang.Record
org.apache.juneau.marshall.hocon.HoconTokenizer.Token
Record Components:
type - Token type.
stringValue - String value for string tokens; null otherwise.
numberValue - Number value for NUMBER tokens; null otherwise.
Enclosing class:
HoconTokenizer

public static record HoconTokenizer.Token(HoconTokenizer.TokenType type, String stringValue, Number numberValue) extends Record
A token with optional string or number value.
  • Constructor Details

  • Method Details

    • of

      Creates a structural or literal token with no value.
      Parameters:
      type - Token type.
      Returns:
      A new token.
    • string

      public static HoconTokenizer.Token string(String value)
      Creates a string token.
      Parameters:
      value - The string value.
      Returns:
      A new token.
    • quoted

      public static HoconTokenizer.Token quoted(String value)
      Creates a quoted-string token.
      Parameters:
      value - The string value.
      Returns:
      A new token.
    • tripleQuoted

      public static HoconTokenizer.Token tripleQuoted(String value)
      Creates a triple-quoted string token.
      Parameters:
      value - The string value.
      Returns:
      A new token.
    • number

      public static HoconTokenizer.Token number(Number value)
      Creates a number token.
      Parameters:
      value - The number value.
      Returns:
      A new token.
    • substitution

      public static HoconTokenizer.Token substitution(String path, boolean optional)
      Creates a substitution token.
      Parameters:
      path - The reference path.
      optional - Whether it is optional (${?var}).
      Returns:
      A new token.
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • type

      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • stringValue

      public String stringValue()
      Returns the value of the stringValue record component.
      Returns:
      the value of the stringValue record component
    • numberValue

      public Number numberValue()
      Returns the value of the numberValue record component.
      Returns:
      the value of the numberValue record component