Package com.yahoo.jrt

Class StringValue

java.lang.Object
com.yahoo.jrt.Value
com.yahoo.jrt.StringValue

public class StringValue extends Value
String value. The internal string representation is UTF-8 encoded bytes. This means that creating an object of this class as well as extracting the value contained with the asString method will incur a string conversion overhead.
  • Constructor Details

    • StringValue

      public StringValue(String value)
      Create from a Java-type value
      Parameters:
      value - the value
    • StringValue

      public StringValue(com.yahoo.text.Utf8String value)
    • StringValue

      public StringValue(com.yahoo.text.Utf8Array value)
  • Method Details

    • type

      public byte type()
      Description copied from class: Value
      Obtain the type identifier for this value
      Specified by:
      type in class Value
      Returns:
      STRING
    • count

      public int count()
      Description copied from class: Value
      Obtain the number of entries stored in this value. This is 1 for basic data types and the size of the array for array types.
      Specified by:
      count in class Value
      Returns:
      the number of entries stored in this value
    • asString

      public String asString()
      Description copied from class: Value
      Interpret this value as a StringValue and return the contents as an appropriate Java type
      Overrides:
      asString in class Value
      Returns:
      the value contained in this object as a Java type
    • asUtf8Array

      public com.yahoo.text.Utf8Array asUtf8Array()
      Description copied from class: Value
      Interpret this value as a StringValue and return the contents as an appropriate Java type
      Overrides:
      asUtf8Array in class Value
      Returns:
      the value contained in this object as a Java type
    • toString

      public String toString()
      Description copied from class: Value
      Force a proper toString
      Specified by:
      toString in class Value