org.elasticsearch.common.xcontent
Class XContentHelper
java.lang.Object
org.elasticsearch.common.xcontent.XContentHelper
public class XContentHelper
- extends Object
Method Summary |
static String |
convertToJson(byte[] data,
int offset,
int length,
boolean reformatJson)
|
static String |
convertToJson(byte[] data,
int offset,
int length,
boolean reformatJson,
boolean prettyPrint)
|
static String |
convertToJson(BytesReference bytes,
boolean reformatJson)
|
static String |
convertToJson(BytesReference bytes,
boolean reformatJson,
boolean prettyPrint)
|
static Tuple<XContentType,Map<String,Object>> |
convertToMap(byte[] data,
boolean ordered)
|
static Tuple<XContentType,Map<String,Object>> |
convertToMap(byte[] data,
int offset,
int length,
boolean ordered)
|
static Tuple<XContentType,Map<String,Object>> |
convertToMap(BytesReference bytes,
boolean ordered)
|
static void |
copyCurrentEvent(XContentGenerator generator,
XContentParser parser)
|
static void |
copyCurrentStructure(XContentGenerator generator,
XContentParser parser)
|
static XContentParser |
createParser(byte[] data,
int offset,
int length)
|
static XContentParser |
createParser(BytesReference bytes)
|
static void |
mergeDefaults(Map<String,Object> content,
Map<String,Object> defaults)
Merges the defaults provided as the second parameter into the content of the first. |
static void |
update(Map<String,Object> source,
Map<String,Object> changes)
Updates the provided changes into the source. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XContentHelper
public XContentHelper()
createParser
public static XContentParser createParser(BytesReference bytes)
throws IOException
- Throws:
IOException
createParser
public static XContentParser createParser(byte[] data,
int offset,
int length)
throws IOException
- Throws:
IOException
convertToMap
public static Tuple<XContentType,Map<String,Object>> convertToMap(BytesReference bytes,
boolean ordered)
throws ElasticSearchParseException
- Throws:
ElasticSearchParseException
convertToMap
public static Tuple<XContentType,Map<String,Object>> convertToMap(byte[] data,
boolean ordered)
throws ElasticSearchParseException
- Throws:
ElasticSearchParseException
convertToMap
public static Tuple<XContentType,Map<String,Object>> convertToMap(byte[] data,
int offset,
int length,
boolean ordered)
throws ElasticSearchParseException
- Throws:
ElasticSearchParseException
convertToJson
public static String convertToJson(BytesReference bytes,
boolean reformatJson)
throws IOException
- Throws:
IOException
convertToJson
public static String convertToJson(BytesReference bytes,
boolean reformatJson,
boolean prettyPrint)
throws IOException
- Throws:
IOException
convertToJson
public static String convertToJson(byte[] data,
int offset,
int length,
boolean reformatJson)
throws IOException
- Throws:
IOException
convertToJson
public static String convertToJson(byte[] data,
int offset,
int length,
boolean reformatJson,
boolean prettyPrint)
throws IOException
- Throws:
IOException
update
public static void update(Map<String,Object> source,
Map<String,Object> changes)
- Updates the provided changes into the source. If the key exists in the changes, it overrides the one in source
unless both are Maps, in which case it recuersively updated it.
mergeDefaults
public static void mergeDefaults(Map<String,Object> content,
Map<String,Object> defaults)
- Merges the defaults provided as the second parameter into the content of the first. Only does recursive merge
for inner maps.
copyCurrentStructure
public static void copyCurrentStructure(XContentGenerator generator,
XContentParser parser)
throws IOException
- Throws:
IOException
copyCurrentEvent
public static void copyCurrentEvent(XContentGenerator generator,
XContentParser parser)
throws IOException
- Throws:
IOException
Copyright © 2009-2012. All Rights Reserved.