Class ObjectPath

java.lang.Object
org.elasticsearch.test.rest.yaml.ObjectPath

public class ObjectPath
extends java.lang.Object
Holds an object and allows to extract specific values from it given their path
  • Constructor Summary

    Constructors 
    Constructor Description
    ObjectPath​(java.lang.Object object)  
  • Method Summary

    Modifier and Type Method Description
    static ObjectPath createFromResponse​(org.elasticsearch.client.Response response)  
    static ObjectPath createFromXContent​(org.elasticsearch.common.xcontent.XContent xContent, org.elasticsearch.common.bytes.BytesReference input)  
    static <T> T evaluate​(java.lang.Object object, java.lang.String path)
    A utility method that creates an ObjectPath via ObjectPath(Object) returns the result of calling evaluate(String) on it.
    <T> T evaluate​(java.lang.String path)
    Returns the object corresponding to the provided path if present, null otherwise
    <T> T evaluate​(java.lang.String path, Stash stash)
    Returns the object corresponding to the provided path if present, null otherwise
    org.elasticsearch.common.xcontent.XContentBuilder toXContentBuilder​(org.elasticsearch.common.xcontent.XContent xContent)
    Create a new XContentBuilder from the xContent object underlying this ObjectPath.

    Methods inherited from class java.lang.Object

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

    • ObjectPath

      public ObjectPath​(java.lang.Object object)
  • Method Details

    • createFromResponse

      public static ObjectPath createFromResponse​(org.elasticsearch.client.Response response) throws java.io.IOException
      Throws:
      java.io.IOException
    • createFromXContent

      public static ObjectPath createFromXContent​(org.elasticsearch.common.xcontent.XContent xContent, org.elasticsearch.common.bytes.BytesReference input) throws java.io.IOException
      Throws:
      java.io.IOException
    • evaluate

      public static <T> T evaluate​(java.lang.Object object, java.lang.String path) throws java.io.IOException
      A utility method that creates an ObjectPath via ObjectPath(Object) returns the result of calling evaluate(String) on it.
      Throws:
      java.io.IOException
    • evaluate

      public <T> T evaluate​(java.lang.String path) throws java.io.IOException
      Returns the object corresponding to the provided path if present, null otherwise
      Throws:
      java.io.IOException
    • evaluate

      public <T> T evaluate​(java.lang.String path, Stash stash) throws java.io.IOException
      Returns the object corresponding to the provided path if present, null otherwise
      Throws:
      java.io.IOException
    • toXContentBuilder

      public org.elasticsearch.common.xcontent.XContentBuilder toXContentBuilder​(org.elasticsearch.common.xcontent.XContent xContent) throws java.io.IOException
      Create a new XContentBuilder from the xContent object underlying this ObjectPath. This only works for ObjectPath instances created from an xContent object, not from nested substructures. We throw an UnsupportedOperationException in those cases.
      Throws:
      java.io.IOException