Module org.elasticsearch.xcore
Class XContentSource
java.lang.Object
org.elasticsearch.xpack.core.watcher.support.xcontent.XContentSource
- All Implemented Interfaces:
org.elasticsearch.xcontent.ToXContent
Encapsulates the xcontent source
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
org.elasticsearch.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.xcontent.ToXContent.MapParams, org.elasticsearch.xcontent.ToXContent.Params -
Field Summary
Fields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionXContentSource(BytesReference bytes, org.elasticsearch.xcontent.XContentType xContentType) Constructs a new XContentSource out of the given bytes reference.XContentSource(org.elasticsearch.xcontent.XContentBuilder builder) Constructs a new xcontent source from the bytes of the given xcontent builder -
Method Summary
Modifier and TypeMethodDescriptionbooleangetAsMap()getBytes()org.elasticsearch.xcontent.XContentType<T> TExtracts a value identified by the given path in the source.inthashCode()booleanisList()booleanisMap()org.elasticsearch.xcontent.XContentParserparser(BytesReference bytes) static XContentSourcereadFrom(StreamInput in) toString()org.elasticsearch.xcontent.XContentBuildertoXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) static voidwriteTo(XContentSource source, StreamOutput out) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.elasticsearch.xcontent.ToXContent
isFragment
-
Constructor Details
-
XContentSource
public XContentSource(BytesReference bytes, org.elasticsearch.xcontent.XContentType xContentType) throws ElasticsearchParseException Constructs a new XContentSource out of the given bytes reference.- Throws:
ElasticsearchParseException
-
XContentSource
public XContentSource(org.elasticsearch.xcontent.XContentBuilder builder) Constructs a new xcontent source from the bytes of the given xcontent builder
-
-
Method Details
-
getContentType
public org.elasticsearch.xcontent.XContentType getContentType()- Returns:
- The content type of the source
-
getBytes
- Returns:
- The bytes reference of the source
-
isMap
public boolean isMap()- Returns:
- true if the top level value of the source is a map
-
getAsMap
- Returns:
- The source as a map
-
isList
public boolean isList()- Returns:
- true if the top level value of the source is a list
-
getAsList
- Returns:
- The source as a list
-
getValue
Extracts a value identified by the given path in the source.- Parameters:
path- a dot notation path to the requested value- Returns:
- The extracted value or
nullif no value is associated with the given path
-
toXContent
public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceorg.elasticsearch.xcontent.ToXContent- Throws:
IOException
-
parser
- Throws:
IOException
-
readFrom
- Throws:
IOException
-
writeTo
- Throws:
IOException
-
equals
-
hashCode
public int hashCode() -
toString
-