org.elasticsearch.util.xcontent.builder
Class XContentBuilder<T extends XContentBuilder>

java.lang.Object
  extended by org.elasticsearch.util.xcontent.builder.XContentBuilder<T>
Direct Known Subclasses:
BinaryXContentBuilder, TextXContentBuilder

public abstract class XContentBuilder<T extends XContentBuilder>
extends java.lang.Object


Nested Class Summary
static class XContentBuilder.FieldCaseConversion
           
 
Field Summary
protected  T builder
           
protected  java.lang.StringBuilder cachedStringBuilder
           
static org.joda.time.format.DateTimeFormatter defaultDatePrinter
           
protected  XContentBuilder.FieldCaseConversion fieldCaseConversion
           
protected  XContentGenerator generator
           
protected static XContentBuilder.FieldCaseConversion globalFieldCaseConversion
           
 
Constructor Summary
XContentBuilder()
           
 
Method Summary
 T array(java.lang.String name, java.lang.Object... values)
           
 T array(java.lang.String name, java.lang.String... values)
           
 void close()
           
 XContentType contentType()
           
abstract  byte[] copiedBytes()
           
 T endArray()
           
 T endObject()
           
 T field(java.lang.String name)
           
 T field(java.lang.String name, boolean value)
           
 T field(java.lang.String name, byte[] value)
           
 T field(java.lang.String name, char[] value, int offset, int length)
           
 T field(java.lang.String name, java.util.Date date)
           
 T field(java.lang.String name, java.util.Date date, org.joda.time.format.DateTimeFormatter formatter)
           
 T field(java.lang.String name, double value)
           
 T field(java.lang.String name, java.lang.Double value)
           
 T field(java.lang.String name, float value)
           
 T field(java.lang.String name, java.lang.Float value)
           
 T field(java.lang.String name, int value)
           
 T field(java.lang.String name, java.lang.Integer value)
           
 T field(java.lang.String name, long value)
           
 T field(java.lang.String name, java.lang.Long value)
           
 T field(java.lang.String name, java.lang.Object value)
           
 T field(java.lang.String name, org.joda.time.ReadableInstant date)
           
 T field(java.lang.String name, org.joda.time.ReadableInstant date, org.joda.time.format.DateTimeFormatter formatter)
           
 T field(java.lang.String name, java.lang.String value)
           
 T fieldCaseConversion(XContentBuilder.FieldCaseConversion fieldCaseConversion)
           
 T flush()
           
static void globalFieldCaseConversion(XContentBuilder.FieldCaseConversion globalFieldCaseConversion)
           
 T map(java.util.Map<java.lang.String,java.lang.Object> map)
           
 T nullField(java.lang.String name)
           
 T nullValue()
           
 T prettyPrint()
           
abstract  T raw(byte[] content)
           
 T rawField(java.lang.String fieldName, byte[] content)
           
abstract  T reset()
           
 T startArray()
           
 T startArray(java.lang.String name)
           
 T startObject()
           
 T startObject(java.lang.String name)
           
abstract  java.lang.String string()
           
abstract  byte[] unsafeBytes()
           
abstract  int unsafeBytesLength()
           
 T value(boolean value)
           
 T value(java.lang.Boolean value)
           
 T value(byte[] value)
           
 T value(java.util.Date date)
           
 T value(java.util.Date date, org.joda.time.format.DateTimeFormatter dateTimeFormatter)
           
 T value(double value)
           
 T value(java.lang.Double value)
           
 T value(float value)
           
 T value(java.lang.Float value)
           
 T value(int value)
           
 T value(java.lang.Integer value)
           
 T value(long value)
           
 T value(java.lang.Long value)
           
 T value(java.lang.Object value)
           
 T value(org.joda.time.ReadableInstant date)
           
 T value(org.joda.time.ReadableInstant date, org.joda.time.format.DateTimeFormatter dateTimeFormatter)
           
 T value(java.lang.String value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultDatePrinter

public static final org.joda.time.format.DateTimeFormatter defaultDatePrinter

globalFieldCaseConversion

protected static XContentBuilder.FieldCaseConversion globalFieldCaseConversion

generator

protected XContentGenerator generator

builder

protected T extends XContentBuilder builder

fieldCaseConversion

protected XContentBuilder.FieldCaseConversion fieldCaseConversion

cachedStringBuilder

protected java.lang.StringBuilder cachedStringBuilder
Constructor Detail

XContentBuilder

public XContentBuilder()
Method Detail

globalFieldCaseConversion

public static void globalFieldCaseConversion(XContentBuilder.FieldCaseConversion globalFieldCaseConversion)

fieldCaseConversion

public T fieldCaseConversion(XContentBuilder.FieldCaseConversion fieldCaseConversion)

contentType

public XContentType contentType()

prettyPrint

public T prettyPrint()

map

public T map(java.util.Map<java.lang.String,java.lang.Object> map)
                              throws java.io.IOException
Throws:
java.io.IOException

startObject

public T startObject(java.lang.String name)
                                      throws java.io.IOException
Throws:
java.io.IOException

startObject

public T startObject()
                                      throws java.io.IOException
Throws:
java.io.IOException

endObject

public T endObject()
                                    throws java.io.IOException
Throws:
java.io.IOException

array

public T array(java.lang.String name,
               java.lang.String... values)
                                throws java.io.IOException
Throws:
java.io.IOException

array

public T array(java.lang.String name,
               java.lang.Object... values)
                                throws java.io.IOException
Throws:
java.io.IOException

startArray

public T startArray(java.lang.String name)
                                     throws java.io.IOException
Throws:
java.io.IOException

startArray

public T startArray()
                                     throws java.io.IOException
Throws:
java.io.IOException

endArray

public T endArray()
                                   throws java.io.IOException
Throws:
java.io.IOException

field

public T field(java.lang.String name)
                                throws java.io.IOException
Throws:
java.io.IOException

field

public T field(java.lang.String name,
               char[] value,
               int offset,
               int length)
                                throws java.io.IOException
Throws:
java.io.IOException

field

public T field(java.lang.String name,
               java.lang.String value)
                                throws java.io.IOException
Throws:
java.io.IOException

field

public T field(java.lang.String name,
               java.lang.Integer value)
                                throws java.io.IOException
Throws:
java.io.IOException

field

public T field(java.lang.String name,
               int value)
                                throws java.io.IOException
Throws:
java.io.IOException

field

public T field(java.lang.String name,
               java.lang.Long value)
                                throws java.io.IOException
Throws:
java.io.IOException

field

public T field(java.lang.String name,
               long value)
                                throws java.io.IOException
Throws:
java.io.IOException

field

public T field(java.lang.String name,
               java.lang.Float value)
                                throws java.io.IOException
Throws:
java.io.IOException

field

public T field(java.lang.String name,
               float value)
                                throws java.io.IOException
Throws:
java.io.IOException

field

public T field(java.lang.String name,
               java.lang.Double value)
                                throws java.io.IOException
Throws:
java.io.IOException

field

public T field(java.lang.String name,
               double value)
                                throws java.io.IOException
Throws:
java.io.IOException

field

public T field(java.lang.String name,
               java.lang.Object value)
                                throws java.io.IOException
Throws:
java.io.IOException

field

public T field(java.lang.String name,
               boolean value)
                                throws java.io.IOException
Throws:
java.io.IOException

field

public T field(java.lang.String name,
               byte[] value)
                                throws java.io.IOException
Throws:
java.io.IOException

field

public T field(java.lang.String name,
               org.joda.time.ReadableInstant date)
                                throws java.io.IOException
Throws:
java.io.IOException

field

public T field(java.lang.String name,
               org.joda.time.ReadableInstant date,
               org.joda.time.format.DateTimeFormatter formatter)
                                throws java.io.IOException
Throws:
java.io.IOException

field

public T field(java.lang.String name,
               java.util.Date date)
                                throws java.io.IOException
Throws:
java.io.IOException

field

public T field(java.lang.String name,
               java.util.Date date,
               org.joda.time.format.DateTimeFormatter formatter)
                                throws java.io.IOException
Throws:
java.io.IOException

nullField

public T nullField(java.lang.String name)
                                    throws java.io.IOException
Throws:
java.io.IOException

nullValue

public T nullValue()
                                    throws java.io.IOException
Throws:
java.io.IOException

rawField

public T rawField(java.lang.String fieldName,
                  byte[] content)
                                   throws java.io.IOException
Throws:
java.io.IOException

raw

public abstract T raw(byte[] content)
                                       throws java.io.IOException
Throws:
java.io.IOException

value

public T value(java.lang.Boolean value)
                                throws java.io.IOException
Throws:
java.io.IOException

value

public T value(boolean value)
                                throws java.io.IOException
Throws:
java.io.IOException

value

public T value(org.joda.time.ReadableInstant date)
                                throws java.io.IOException
Throws:
java.io.IOException

value

public T value(org.joda.time.ReadableInstant date,
               org.joda.time.format.DateTimeFormatter dateTimeFormatter)
                                throws java.io.IOException
Throws:
java.io.IOException

value

public T value(java.util.Date date)
                                throws java.io.IOException
Throws:
java.io.IOException

value

public T value(java.util.Date date,
               org.joda.time.format.DateTimeFormatter dateTimeFormatter)
                                throws java.io.IOException
Throws:
java.io.IOException

value

public T value(java.lang.Integer value)
                                throws java.io.IOException
Throws:
java.io.IOException

value

public T value(int value)
                                throws java.io.IOException
Throws:
java.io.IOException

value

public T value(java.lang.Long value)
                                throws java.io.IOException
Throws:
java.io.IOException

value

public T value(long value)
                                throws java.io.IOException
Throws:
java.io.IOException

value

public T value(java.lang.Float value)
                                throws java.io.IOException
Throws:
java.io.IOException

value

public T value(float value)
                                throws java.io.IOException
Throws:
java.io.IOException

value

public T value(java.lang.Double value)
                                throws java.io.IOException
Throws:
java.io.IOException

value

public T value(double value)
                                throws java.io.IOException
Throws:
java.io.IOException

value

public T value(java.lang.String value)
                                throws java.io.IOException
Throws:
java.io.IOException

value

public T value(byte[] value)
                                throws java.io.IOException
Throws:
java.io.IOException

value

public T value(java.lang.Object value)
                                throws java.io.IOException
Throws:
java.io.IOException

flush

public T flush()
                                throws java.io.IOException
Throws:
java.io.IOException

close

public void close()

reset

public abstract T reset()
                                         throws java.io.IOException
Throws:
java.io.IOException

unsafeBytes

public abstract byte[] unsafeBytes()
                            throws java.io.IOException
Throws:
java.io.IOException

unsafeBytesLength

public abstract int unsafeBytesLength()
                               throws java.io.IOException
Throws:
java.io.IOException

copiedBytes

public abstract byte[] copiedBytes()
                            throws java.io.IOException
Throws:
java.io.IOException

string

public abstract java.lang.String string()
                                 throws java.io.IOException
Throws:
java.io.IOException