Class Text

java.lang.Object
org.elasticsearch.common.text.Text
All Implemented Interfaces:
Comparable<Text>, org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentFragment

public final class Text extends Object implements Comparable<Text>, org.elasticsearch.xcontent.ToXContentFragment
Both String and BytesReference representation of the text. Starts with one of those, and if the other is requests, caches the other one in a local reference so no additional conversion will be needed.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent

    org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.xcontent.ToXContent.Params
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Text[]
     

    Fields inherited from interface org.elasticsearch.xcontent.ToXContent

    EMPTY_PARAMS
  • Constructor Summary

    Constructors
    Constructor
    Description
    Text(String text)
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a BytesReference view of the data.
    int
     
    static Text[]
     
    boolean
     
    boolean
    Whether a BytesReference view of the data is already materialized.
    int
     
    boolean
    Whether a String view of the data is already materialized.
    Returns a String view of the data.
     
    org.elasticsearch.xcontent.XContentBuilder
    toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params)
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.elasticsearch.xcontent.ToXContentFragment

    isFragment
  • Field Details

    • EMPTY_ARRAY

      public static final Text[] EMPTY_ARRAY
  • Constructor Details

  • Method Details

    • convertFromStringArray

      public static Text[] convertFromStringArray(String[] strings)
    • hasBytes

      public boolean hasBytes()
      Whether a BytesReference view of the data is already materialized.
    • bytes

      public BytesReference bytes()
      Returns a BytesReference view of the data.
    • hasString

      public boolean hasString()
      Whether a String view of the data is already materialized.
    • string

      public String string()
      Returns a String view of the data.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

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

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

      public int compareTo(Text text)
      Specified by:
      compareTo in interface Comparable<Text>
    • toXContent

      public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException
      Specified by:
      toXContent in interface org.elasticsearch.xcontent.ToXContent
      Throws:
      IOException