java.lang.Object
org.elasticsearch.xpack.core.watcher.support.xcontent.XContentSource
All Implemented Interfaces:
org.elasticsearch.xcontent.ToXContent

public class XContentSource extends Object implements 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

    Constructors
    Constructor
    Description
    XContentSource(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 Type
    Method
    Description
    boolean
     
     
     
     
    org.elasticsearch.xcontent.XContentType
     
    <T> T
    Extracts a value identified by the given path in the source.
    int
     
    boolean
     
    boolean
     
    org.elasticsearch.xcontent.XContentParser
     
     
     
    org.elasticsearch.xcontent.XContentBuilder
    toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params)
     
    static void
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods 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

      public BytesReference 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

      public Map<String,Object> 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

      public List<Object> getAsList()
      Returns:
      The source as a list
    • getValue

      public <T> T getValue(String path)
      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 null if 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:
      toXContent in interface org.elasticsearch.xcontent.ToXContent
      Throws:
      IOException
    • parser

      public org.elasticsearch.xcontent.XContentParser parser(BytesReference bytes) throws IOException
      Throws:
      IOException
    • readFrom

      public static XContentSource readFrom(StreamInput in) throws IOException
      Throws:
      IOException
    • writeTo

      public static void writeTo(XContentSource source, StreamOutput out) throws IOException
      Throws:
      IOException
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object