Package org.elasticsearch.test.rest.yaml
Class ObjectPath
- java.lang.Object
-
- org.elasticsearch.test.rest.yaml.ObjectPath
-
public class ObjectPath extends java.lang.ObjectHolds 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 ObjectPathcreateFromResponse(Response response)static ObjectPathcreateFromXContent(XContent xContent, BytesReference input)static <T> Tevaluate(java.lang.Object object, java.lang.String path)A utility method that creates anObjectPathviaObjectPath(Object)returns the result of callingevaluate(String)on it.<T> Tevaluate(java.lang.String path)Returns the object corresponding to the provided path if present, null otherwise<T> Tevaluate(java.lang.String path, Stash stash)Returns the object corresponding to the provided path if present, null otherwiseXContentBuildertoXContentBuilder(XContent xContent)Create a newXContentBuilderfrom the xContent object underlying thisObjectPath.
-
-
-
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.IOExceptionA utility method that creates anObjectPathviaObjectPath(Object)returns the result of callingevaluate(String)on it.- Throws:
java.io.IOException
-
evaluate
public <T> T evaluate(java.lang.String path) throws java.io.IOExceptionReturns 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.IOExceptionReturns 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 newXContentBuilderfrom the xContent object underlying thisObjectPath. This only works forObjectPathinstances created from an xContent object, not from nested substructures. We throw anUnsupportedOperationExceptionin those cases.- Throws:
java.io.IOException
-
-