Class XContentSource

java.lang.Object
org.elasticsearch.client.common.XContentSource

public class XContentSource
extends java.lang.Object
Encapsulates the xcontent source
  • Constructor Summary

    Constructors
    Constructor Description
    XContentSource​(org.elasticsearch.common.xcontent.XContentParser parser)
    Constructs a new XContentSource out of the given parser
  • Method Summary

    Modifier and Type Method Description
    java.util.List<java.lang.Object> getAsList()  
    java.util.Map<java.lang.String,​java.lang.Object> getAsMap()  
    <T> T getValue​(java.lang.String path)
    Extracts a value identified by the given path in the source.
    boolean isList()  
    boolean isMap()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • XContentSource

      public XContentSource​(org.elasticsearch.common.xcontent.XContentParser parser) throws java.io.IOException
      Constructs a new XContentSource out of the given parser
      Throws:
      java.io.IOException
  • Method Details

    • isMap

      public boolean isMap()
      Returns:
      true if the top level value of the source is a map
    • getAsMap

      public java.util.Map<java.lang.String,​java.lang.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 java.util.List<java.lang.Object> getAsList()
      Returns:
      The source as a list
    • getValue

      public <T> T getValue​(java.lang.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