org.elasticsearch.common.xcontent
Class XContentBuilder
java.lang.Object
org.elasticsearch.common.xcontent.XContentBuilder
- All Implemented Interfaces:
- BytesStream
public final class XContentBuilder
- extends Object
- implements BytesStream
Method Summary |
XContentBuilder |
array(String name,
Object... values)
|
XContentBuilder |
array(String name,
String... values)
|
XContentBuilder |
array(XContentBuilderString name,
Object... values)
|
XContentBuilder |
array(XContentBuilderString name,
String... values)
|
static XContentBuilder |
builder(XContent xContent)
Constructs a new builder using a fresh FastByteArrayOutputStream . |
BytesReference |
bytes()
|
BytesStream |
bytesStream()
Returns the actual stream used. |
void |
close()
|
XContentType |
contentType()
|
XContentBuilder |
copyCurrentStructure(XContentParser parser)
|
XContentBuilder |
endArray()
|
XContentBuilder |
endObject()
|
XContentBuilder |
field(String name)
|
XContentBuilder |
field(String name,
BigDecimal value)
|
XContentBuilder |
field(String name,
BigDecimal value,
int scale,
RoundingMode rounding,
boolean toDouble)
|
XContentBuilder |
field(String name,
boolean value)
|
XContentBuilder |
field(String name,
byte[] value)
|
XContentBuilder |
field(String name,
byte[] value,
int offset,
int length)
|
XContentBuilder |
field(String name,
BytesReference value)
|
XContentBuilder |
field(String name,
char[] value,
int offset,
int length)
|
XContentBuilder |
field(String name,
Date date)
|
XContentBuilder |
field(String name,
Date date,
org.joda.time.format.DateTimeFormatter formatter)
|
XContentBuilder |
field(String name,
double... value)
|
XContentBuilder |
field(String name,
double value)
|
XContentBuilder |
field(String name,
Double value)
|
XContentBuilder |
field(String name,
float... value)
|
XContentBuilder |
field(String name,
float value)
|
XContentBuilder |
field(String name,
Float value)
|
XContentBuilder |
field(String name,
int... value)
|
XContentBuilder |
field(String name,
int value)
|
XContentBuilder |
field(String name,
Integer value)
|
XContentBuilder |
field(String name,
Iterable value)
|
XContentBuilder |
field(String name,
long... value)
|
XContentBuilder |
field(String name,
long value)
|
XContentBuilder |
field(String name,
Long value)
|
XContentBuilder |
field(String name,
Map<String,Object> value)
|
XContentBuilder |
field(String name,
Object... value)
|
XContentBuilder |
field(String name,
Object value)
|
XContentBuilder |
field(String name,
org.joda.time.ReadableInstant date)
|
XContentBuilder |
field(String name,
org.joda.time.ReadableInstant date,
org.joda.time.format.DateTimeFormatter formatter)
|
XContentBuilder |
field(String name,
String... value)
|
XContentBuilder |
field(String name,
String value)
|
XContentBuilder |
field(String name,
String value,
XContentBuilder.FieldCaseConversion conversion)
|
XContentBuilder |
field(String name,
Text value)
|
XContentBuilder |
field(String name,
ToXContent xContent)
|
XContentBuilder |
field(String name,
ToXContent xContent,
ToXContent.Params params)
|
XContentBuilder |
field(String name,
XContentBuilder.FieldCaseConversion conversion)
|
XContentBuilder |
field(XContentBuilderString name)
|
XContentBuilder |
field(XContentBuilderString name,
BigDecimal value)
|
XContentBuilder |
field(XContentBuilderString name,
BigDecimal value,
int scale,
RoundingMode rounding,
boolean toDouble)
|
XContentBuilder |
field(XContentBuilderString name,
boolean value)
|
XContentBuilder |
field(XContentBuilderString name,
byte[] value)
|
XContentBuilder |
field(XContentBuilderString name,
char[] value,
int offset,
int length)
|
XContentBuilder |
field(XContentBuilderString name,
Date date)
|
XContentBuilder |
field(XContentBuilderString name,
Date date,
org.joda.time.format.DateTimeFormatter formatter)
|
XContentBuilder |
field(XContentBuilderString name,
double... value)
|
XContentBuilder |
field(XContentBuilderString name,
double value)
|
XContentBuilder |
field(XContentBuilderString name,
Double value)
|
XContentBuilder |
field(XContentBuilderString name,
float... value)
|
XContentBuilder |
field(XContentBuilderString name,
float value)
|
XContentBuilder |
field(XContentBuilderString name,
Float value)
|
XContentBuilder |
field(XContentBuilderString name,
int... value)
|
XContentBuilder |
field(XContentBuilderString name,
int value)
|
XContentBuilder |
field(XContentBuilderString name,
Integer value)
|
XContentBuilder |
field(XContentBuilderString name,
Iterable value)
|
XContentBuilder |
field(XContentBuilderString name,
long... value)
|
XContentBuilder |
field(XContentBuilderString name,
long value)
|
XContentBuilder |
field(XContentBuilderString name,
Long value)
|
XContentBuilder |
field(XContentBuilderString name,
Map<String,Object> value)
|
XContentBuilder |
field(XContentBuilderString name,
Object... value)
|
XContentBuilder |
field(XContentBuilderString name,
Object value)
|
XContentBuilder |
field(XContentBuilderString name,
org.joda.time.ReadableInstant date)
|
XContentBuilder |
field(XContentBuilderString name,
org.joda.time.ReadableInstant date,
org.joda.time.format.DateTimeFormatter formatter)
|
XContentBuilder |
field(XContentBuilderString name,
String... value)
|
XContentBuilder |
field(XContentBuilderString name,
String value)
|
XContentBuilder |
field(XContentBuilderString name,
String value,
XContentBuilder.FieldCaseConversion conversion)
|
XContentBuilder |
field(XContentBuilderString name,
XContentBuilder.FieldCaseConversion conversion)
|
XContentBuilder |
fieldCaseConversion(XContentBuilder.FieldCaseConversion fieldCaseConversion)
|
XContentBuilder |
flush()
|
static void |
globalFieldCaseConversion(XContentBuilder.FieldCaseConversion globalFieldCaseConversion)
|
XContentBuilder |
map(Map<String,Object> map)
|
XContentBuilder |
nullField(String name)
|
XContentBuilder |
nullField(XContentBuilderString name)
|
XContentBuilder |
nullValue()
|
Object |
payload()
|
XContentBuilder |
prettyPrint()
|
XContentBuilder |
rawField(String fieldName,
byte[] content)
|
XContentBuilder |
rawField(String fieldName,
byte[] content,
int offset,
int length)
|
XContentBuilder |
rawField(String fieldName,
BytesReference content)
|
XContentBuilder |
rawField(String fieldName,
InputStream content)
|
XContentBuilder |
startArray()
|
XContentBuilder |
startArray(String name)
|
XContentBuilder |
startArray(String name,
XContentBuilder.FieldCaseConversion conversion)
|
XContentBuilder |
startArray(XContentBuilderString name)
|
XContentBuilder |
startObject()
|
XContentBuilder |
startObject(String name)
|
XContentBuilder |
startObject(String name,
XContentBuilder.FieldCaseConversion conversion)
|
XContentBuilder |
startObject(XContentBuilderString name)
|
XContentBuilder |
startObject(XContentBuilderString name,
XContentBuilder.FieldCaseConversion conversion)
|
OutputStream |
stream()
|
String |
string()
Returns a string representation of the builder (only applicable for text based xcontent). |
XContentBuilder |
value(boolean value)
|
XContentBuilder |
value(Boolean value)
|
XContentBuilder |
value(byte[] value)
|
XContentBuilder |
value(byte[] value,
int offset,
int length)
|
XContentBuilder |
value(BytesReference value)
|
XContentBuilder |
value(Date date)
|
XContentBuilder |
value(Date date,
org.joda.time.format.DateTimeFormatter dateTimeFormatter)
|
XContentBuilder |
value(double value)
|
XContentBuilder |
value(Double value)
|
XContentBuilder |
value(float value)
|
XContentBuilder |
value(Float value)
|
XContentBuilder |
value(int value)
|
XContentBuilder |
value(Integer value)
|
XContentBuilder |
value(Iterable value)
|
XContentBuilder |
value(long value)
|
XContentBuilder |
value(Long value)
|
XContentBuilder |
value(Map<String,Object> map)
|
XContentBuilder |
value(Object value)
|
XContentBuilder |
value(org.joda.time.ReadableInstant date)
|
XContentBuilder |
value(org.joda.time.ReadableInstant date,
org.joda.time.format.DateTimeFormatter dateTimeFormatter)
|
XContentBuilder |
value(String value)
|
XContentBuilder |
value(Text value)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
defaultDatePrinter
public static final org.joda.time.format.DateTimeFormatter defaultDatePrinter
globalFieldCaseConversion
protected static XContentBuilder.FieldCaseConversion globalFieldCaseConversion
XContentBuilder
public XContentBuilder(XContent xContent,
OutputStream bos)
throws IOException
- Constructs a new builder using the provided xcontent and an OutputStream. Make sure
to call
close()
when the builder is done with.
- Throws:
IOException
XContentBuilder
public XContentBuilder(XContent xContent,
OutputStream bos,
@Nullable
Object payload)
throws IOException
- Constructs a new builder using the provided xcontent and an OutputStream. Make sure
to call
close()
when the builder is done with.
- Throws:
IOException
globalFieldCaseConversion
public static void globalFieldCaseConversion(XContentBuilder.FieldCaseConversion globalFieldCaseConversion)
builder
public static XContentBuilder builder(XContent xContent)
throws IOException
- Constructs a new builder using a fresh
FastByteArrayOutputStream
.
- Throws:
IOException
fieldCaseConversion
public XContentBuilder fieldCaseConversion(XContentBuilder.FieldCaseConversion fieldCaseConversion)
contentType
public XContentType contentType()
prettyPrint
public XContentBuilder prettyPrint()
field
public XContentBuilder field(String name,
ToXContent xContent)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
ToXContent xContent,
ToXContent.Params params)
throws IOException
- Throws:
IOException
startObject
public XContentBuilder startObject(String name)
throws IOException
- Throws:
IOException
startObject
public XContentBuilder startObject(String name,
XContentBuilder.FieldCaseConversion conversion)
throws IOException
- Throws:
IOException
startObject
public XContentBuilder startObject(XContentBuilderString name)
throws IOException
- Throws:
IOException
startObject
public XContentBuilder startObject(XContentBuilderString name,
XContentBuilder.FieldCaseConversion conversion)
throws IOException
- Throws:
IOException
startObject
public XContentBuilder startObject()
throws IOException
- Throws:
IOException
endObject
public XContentBuilder endObject()
throws IOException
- Throws:
IOException
array
public XContentBuilder array(String name,
String... values)
throws IOException
- Throws:
IOException
array
public XContentBuilder array(XContentBuilderString name,
String... values)
throws IOException
- Throws:
IOException
array
public XContentBuilder array(String name,
Object... values)
throws IOException
- Throws:
IOException
array
public XContentBuilder array(XContentBuilderString name,
Object... values)
throws IOException
- Throws:
IOException
startArray
public XContentBuilder startArray(String name,
XContentBuilder.FieldCaseConversion conversion)
throws IOException
- Throws:
IOException
startArray
public XContentBuilder startArray(String name)
throws IOException
- Throws:
IOException
startArray
public XContentBuilder startArray(XContentBuilderString name)
throws IOException
- Throws:
IOException
startArray
public XContentBuilder startArray()
throws IOException
- Throws:
IOException
endArray
public XContentBuilder endArray()
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
XContentBuilder.FieldCaseConversion conversion)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
XContentBuilder.FieldCaseConversion conversion)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
char[] value,
int offset,
int length)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
char[] value,
int offset,
int length)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
String value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
String value,
XContentBuilder.FieldCaseConversion conversion)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
String value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
String value,
XContentBuilder.FieldCaseConversion conversion)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
Integer value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
Integer value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
int value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
int value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
Long value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
Long value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
long value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
long value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
Float value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
Float value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
float value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
float value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
Double value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
Double value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
double value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
double value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
BigDecimal value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
BigDecimal value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
BigDecimal value,
int scale,
RoundingMode rounding,
boolean toDouble)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
BigDecimal value,
int scale,
RoundingMode rounding,
boolean toDouble)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
BytesReference value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
Text value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
byte[] value,
int offset,
int length)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
Map<String,Object> value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
Map<String,Object> value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
Iterable value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
Iterable value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
String... value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
String... value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
Object... value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
Object... value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
int... value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
int... value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
long... value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
long... value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
float... value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
float... value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
double... value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
double... value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
Object value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
Object value)
throws IOException
- Throws:
IOException
value
public XContentBuilder value(Object value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
boolean value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
boolean value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
byte[] value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
byte[] value)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
org.joda.time.ReadableInstant date)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
org.joda.time.ReadableInstant date)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
org.joda.time.ReadableInstant date,
org.joda.time.format.DateTimeFormatter formatter)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
org.joda.time.ReadableInstant date,
org.joda.time.format.DateTimeFormatter formatter)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
Date date)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
Date date)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(String name,
Date date,
org.joda.time.format.DateTimeFormatter formatter)
throws IOException
- Throws:
IOException
field
public XContentBuilder field(XContentBuilderString name,
Date date,
org.joda.time.format.DateTimeFormatter formatter)
throws IOException
- Throws:
IOException
nullField
public XContentBuilder nullField(String name)
throws IOException
- Throws:
IOException
nullField
public XContentBuilder nullField(XContentBuilderString name)
throws IOException
- Throws:
IOException
nullValue
public XContentBuilder nullValue()
throws IOException
- Throws:
IOException
rawField
public XContentBuilder rawField(String fieldName,
byte[] content)
throws IOException
- Throws:
IOException
rawField
public XContentBuilder rawField(String fieldName,
byte[] content,
int offset,
int length)
throws IOException
- Throws:
IOException
rawField
public XContentBuilder rawField(String fieldName,
InputStream content)
throws IOException
- Throws:
IOException
rawField
public XContentBuilder rawField(String fieldName,
BytesReference content)
throws IOException
- Throws:
IOException
value
public XContentBuilder value(Boolean value)
throws IOException
- Throws:
IOException
value
public XContentBuilder value(boolean value)
throws IOException
- Throws:
IOException
value
public XContentBuilder value(org.joda.time.ReadableInstant date)
throws IOException
- Throws:
IOException
value
public XContentBuilder value(org.joda.time.ReadableInstant date,
org.joda.time.format.DateTimeFormatter dateTimeFormatter)
throws IOException
- Throws:
IOException
value
public XContentBuilder value(Date date)
throws IOException
- Throws:
IOException
value
public XContentBuilder value(Date date,
org.joda.time.format.DateTimeFormatter dateTimeFormatter)
throws IOException
- Throws:
IOException
value
public XContentBuilder value(Integer value)
throws IOException
- Throws:
IOException
value
public XContentBuilder value(int value)
throws IOException
- Throws:
IOException
value
public XContentBuilder value(Long value)
throws IOException
- Throws:
IOException
value
public XContentBuilder value(long value)
throws IOException
- Throws:
IOException
value
public XContentBuilder value(Float value)
throws IOException
- Throws:
IOException
value
public XContentBuilder value(float value)
throws IOException
- Throws:
IOException
value
public XContentBuilder value(Double value)
throws IOException
- Throws:
IOException
value
public XContentBuilder value(double value)
throws IOException
- Throws:
IOException
value
public XContentBuilder value(String value)
throws IOException
- Throws:
IOException
value
public XContentBuilder value(byte[] value)
throws IOException
- Throws:
IOException
value
public XContentBuilder value(byte[] value,
int offset,
int length)
throws IOException
- Throws:
IOException
value
public XContentBuilder value(BytesReference value)
throws IOException
- Throws:
IOException
value
public XContentBuilder value(Text value)
throws IOException
- Throws:
IOException
map
public XContentBuilder map(Map<String,Object> map)
throws IOException
- Throws:
IOException
value
public XContentBuilder value(Map<String,Object> map)
throws IOException
- Throws:
IOException
value
public XContentBuilder value(Iterable value)
throws IOException
- Throws:
IOException
copyCurrentStructure
public XContentBuilder copyCurrentStructure(XContentParser parser)
throws IOException
- Throws:
IOException
flush
public XContentBuilder flush()
throws IOException
- Throws:
IOException
close
public void close()
payload
@Nullable
public Object payload()
stream
public OutputStream stream()
bytes
public BytesReference bytes()
- Specified by:
bytes
in interface BytesStream
bytesStream
public BytesStream bytesStream()
throws IOException
- Returns the actual stream used.
- Throws:
IOException
string
public String string()
throws IOException
- Returns a string representation of the builder (only applicable for text based xcontent).
Only applicable when the builder is constructed with FastByteArrayOutputStream
.
- Throws:
IOException
Copyright © 2009-2012. All Rights Reserved.