Package org.elasticsearch.common.text
Class Text
java.lang.Object
org.elasticsearch.common.text.Text
- All Implemented Interfaces:
java.lang.Comparable<Text>,org.elasticsearch.common.xcontent.ToXContent,org.elasticsearch.common.xcontent.ToXContentFragment
public final class Text extends java.lang.Object implements java.lang.Comparable<Text>, org.elasticsearch.common.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
-
Field Summary
Fields Modifier and Type Field Description static Text[]EMPTY_ARRAY -
Constructor Summary
Constructors Constructor Description Text(java.lang.String text)Text(BytesReference bytes) -
Method Summary
Modifier and Type Method Description BytesReferencebytes()Returns aBytesReferenceview of the data.intcompareTo(Text text)static Text[]convertFromStringArray(java.lang.String[] strings)booleanequals(java.lang.Object obj)booleanhasBytes()Whether aBytesReferenceview of the data is already materialized.inthashCode()booleanhasString()Whether aStringview of the data is already materialized.java.lang.Stringstring()Returns aStringview of the data.java.lang.StringtoString()org.elasticsearch.common.xcontent.XContentBuildertoXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
-
Field Details
-
Constructor Details
-
Method Details
-
convertFromStringArray
-
hasBytes
public boolean hasBytes()Whether aBytesReferenceview of the data is already materialized. -
bytes
Returns aBytesReferenceview of the data. -
hasString
public boolean hasString()Whether aStringview of the data is already materialized. -
string
public java.lang.String string()Returns aStringview of the data. -
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-
compareTo
- Specified by:
compareToin interfacejava.lang.Comparable<Text>
-
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException- Specified by:
toXContentin interfaceorg.elasticsearch.common.xcontent.ToXContent- Throws:
java.io.IOException
-