java.lang.Object
org.elasticsearch.xcontent.Text
- All Implemented Interfaces:
- Comparable<Text>,- ToXContent,- ToXContentFragment,- XContentString
public final class Text
extends Object
implements XContentString, Comparable<Text>, ToXContentFragment
Both 
String and XContentString.UTF8Bytes representation of the text. Starts with one of those, and if
 the other is requested, caches the other one in a local reference so no additional conversion will be needed.- 
Nested Class SummaryNested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContentToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.xcontent.XContentStringXContentString.UTF8Bytes
- 
Field SummaryFieldsFields inherited from interface org.elasticsearch.xcontent.ToXContentEMPTY, EMPTY_PARAMS
- 
Constructor SummaryConstructorsConstructorDescriptionText(XContentString.UTF8Bytes bytes) Construct a Text from encoded UTF8Bytes.Text(XContentString.UTF8Bytes bytes, int stringLength) Construct a Text from encoded UTF8Bytes and an explicit string length.
- 
Method SummaryModifier and TypeMethodDescriptionbytes()Returns an encodedXContentString.UTF8Bytesview of the data.intstatic Text[]convertFromStringArray(String[] strings) booleanbooleanhasBytes()Whether anXContentString.UTF8Bytesview of the data is already materialized.inthashCode()booleanWhether aStringview of the data is already materialized.string()Returns aStringview of the data.intReturns the number of characters in the represented string.toString()toXContent(XContentBuilder builder, ToXContent.Params params) Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContentFragmentisFragment
- 
Field Details- 
EMPTY_ARRAY
 
- 
- 
Constructor Details- 
TextConstruct a Text from encoded UTF8Bytes. Since no string length is specified,stringLength()will perform a string conversion to measure the string length.
- 
TextConstruct a Text from encoded UTF8Bytes and an explicit string length. Used to avoid string conversion instringLength(). The provided stringLength should match the value that would be calculated byText(UTF8Bytes).
- 
Text
 
- 
- 
Method Details- 
convertFromStringArray
- 
hasBytespublic boolean hasBytes()Whether anXContentString.UTF8Bytesview of the data is already materialized.
- 
bytesDescription copied from interface:XContentStringReturns an encodedXContentString.UTF8Bytesview of the data.- Specified by:
- bytesin interface- XContentString
 
- 
hasStringpublic boolean hasString()Whether aStringview of the data is already materialized.
- 
stringDescription copied from interface:XContentStringReturns aStringview of the data.- Specified by:
- stringin interface- XContentString
 
- 
stringLengthpublic int stringLength()Description copied from interface:XContentStringReturns the number of characters in the represented string.- Specified by:
- stringLengthin interface- XContentString
 
- 
toString
- 
hashCodepublic int hashCode()
- 
equals
- 
compareTo- Specified by:
- compareToin interface- Comparable<Text>
 
- 
toXContentpublic XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
- toXContentin interface- ToXContent
- Throws:
- IOException
 
 
-