Class ObjectPath


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

      • ObjectPath

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

      • createFromResponse

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

        public static ObjectPath createFromXContent​(XContent xContent,
                                                    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 XContentBuilder toXContentBuilder​(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