Module org.elasticsearch.xcore
Class XContentSource
java.lang.Object
org.elasticsearch.xpack.core.watcher.support.xcontent.XContentSource
- All Implemented Interfaces:
ToXContent
Encapsulates the xcontent source
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params -
Field Summary
Fields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY, EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionXContentSource(BytesReference bytes, XContentType xContentType) Constructs a new XContentSource out of the given bytes reference.XContentSource(XContentBuilder builder) Constructs a new xcontent source from the bytes of the given xcontent builder -
Method Summary
Modifier and TypeMethodDescriptionbooleangetAsMap()getBytes()<T> TExtracts a value identified by the given path in the source.inthashCode()booleanisList()booleanisMap()parser(BytesReference bytes) static XContentSourcereadFrom(StreamInput in) toString()toXContent(XContentBuilder builder, 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, XContentType xContentType) throws ElasticsearchParseException Constructs a new XContentSource out of the given bytes reference.- Throws:
ElasticsearchParseException
-
XContentSource
Constructs a new xcontent source from the bytes of the given xcontent builder
-
-
Method Details
-
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 XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-
parser
- Throws:
IOException
-
readFrom
- Throws:
IOException
-
writeTo
- Throws:
IOException
-
equals
-
hashCode
public int hashCode() -
toString
-