ObjectPath Class
- java.
lang. Object - com.
microsoft. bot. dialogs. ObjectPath
- com.
public final class ObjectPath
Helper methods for working with dynamic json objects.
Method Summary
| Modifier and Type | Method and Description |
|---|---|
| static T |
<T>assign(T startObject, Object overlayObject)
Equivalent to javascripts Object |
| static T |
<T>assign(Object startObject, Object overlayObject, Class<T> type)
Equivalent to javascripts Object |
| static T |
<T>clone(T obj)
Clone an Object. |
| static T |
<T>getPathValue(Object obj, String path, Class<T> valueType)
Get the value for a path relative to an Object. |
| static T |
<T>getPathValue(Object obj, String path, Class<T> valueType, T defaultValue)
Get the value for a path relative to an Object. |
| static T |
<T>mapValueTo(Object val, Class<T> valueType)
Convert a generic Object to a typed Object. |
| static T |
<T>merge(Object startObject, Object overlayObject)
Equivalent to javascripts Object |
| static T |
<T>merge(Object startObject, Object overlayObject, Class<T> type)
Equivalent to javascripts Object |
| static T |
<T>tryGetPathValue(Object obj, String path, Class<T> valueType)
Get the value for a path relative to an Object. |
| static com.microsoft.bot.dialogs.Segments |
<T>tryResolvePath(Object obj, String propertyPath)
Given an root Object and property path, resolve to a constant if eval = true or a constant path otherwise. |
| static com.microsoft.bot.dialogs.Segments |
<T>tryResolvePath(Object obj, String propertyPath, boolean eval)
Given an root Object and property path, resolve to a constant if eval = true or a constant path otherwise. |
| static boolean |
containsProperty(Object obj, String name)
Detects if property exists on Object. |
| static void |
forEachProperty(Object obj, BiConsumer<String,Object> action)
Apply an action to all properties in an Object. |
| static java.util.Collection<java.lang.String> |
getProperties(Object obj)
Get all properties in an Object. |
| static boolean |
hasValue(Object obj, String path)
Does an Object have a subpath. |
| static void |
removePathValue(Object obj, String path)
Remove path from Object. |
| static void |
setPathValue(Object obj, String path, Object value)
Given an Object evaluate a path to set the value. |
| static void |
setPathValue(Object obj, String path, Object value, boolean json)
Given an Object evaluate a path to set the value. |
Methods inherited from java.lang.Object
Method Details
<T>assign
public static T
Equivalent to javascripts ObjectPath.Assign, creates a new Object from startObject overlaying any non-null values from the overlay Object.
Parameters:
Returns:
<T>assign
public static T
Equivalent to javascripts ObjectPath.Assign, creates a new Object from startObject overlaying any non-null values from the overlay Object.
Parameters:
Returns:
<T>clone
public static T
Clone an Object.
Parameters:
Returns:
<T>getPathValue
public static T
Get the value for a path relative to an Object.
Parameters:
Returns:
<T>getPathValue
public static T
Get the value for a path relative to an Object.
Parameters:
Returns:
<T>mapValueTo
public static T
Convert a generic Object to a typed Object.
Parameters:
Returns:
<T>merge
public static T
Equivalent to javascripts ObjectPath.Assign, creates a new Object from startObject overlaying any non-null values from the overlay Object.
Parameters:
Returns:
<T>merge
public static T
Equivalent to javascripts ObjectPath.Assign, creates a new Object from startObject overlaying any non-null values from the overlay Object.
Parameters:
Returns:
<T>tryGetPathValue
public static T
Get the value for a path relative to an Object.
Parameters:
Returns:
<T>tryResolvePath
public static Segments
Given an root Object and property path, resolve to a constant if eval = true or a constant path otherwise. conversation[user.name][user.age] to ['conversation', 'joe', 32].
Parameters:
Returns:
<T>tryResolvePath
public static Segments
Given an root Object and property path, resolve to a constant if eval = true or a constant path otherwise. conversation[user.name][user.age] to ['conversation', 'joe', 32].
Parameters:
Returns:
containsProperty
public static boolean containsProperty(Object obj, String name)
Detects if property exists on Object.
Parameters:
Returns:
forEachProperty
public static void forEachProperty(Object obj, BiConsumer
Apply an action to all properties in an Object.
Parameters:
getProperties
public static Collection
Get all properties in an Object.
Parameters:
Returns:
hasValue
public static boolean hasValue(Object obj, String path)
Does an Object have a subpath.
Parameters:
Returns:
removePathValue
public static void removePathValue(Object obj, String path)
Remove path from Object.
Parameters:
setPathValue
public static void setPathValue(Object obj, String path, Object value)
Given an Object evaluate a path to set the value.
Parameters:
setPathValue
public static void setPathValue(Object obj, String path, Object value, boolean json)
Given an Object evaluate a path to set the value.
Parameters: