Package org.jdrupes.vmoperator.util
Class DataPath
java.lang.Object
org.jdrupes.vmoperator.util.DataPath
Utility class that supports navigation through arbitrary data structures.
-
Method Summary
-
Method Details
-
get
Apply the given selectors on the given object and return the value reached.Selectors can be if type
String
orNumber
. The former are used to access a property of an object, the latter to access an element in an array or aList
.Depending on the object currently visited, a
String
can be the key of aMap
, the property part of a getter method or the name of a method that has an empty parameter list.- Type Parameters:
T
- the generic type- Parameters:
from
- the fromselectors
- the selectors- Returns:
- the result
-
deepCopy
Attempts to make a as-deep-as-possible copy of the given container.New containers will be created for Maps, Lists and Arrays. The method is invoked recursively for the entries/items.
If invoked with an object that is neither a map, list or array, the methods checks if the object implements
Cloneable
and if it does, invokes itsObject.clone()
method. Else the method return the object.- Type Parameters:
T
- the generic type- Parameters:
object
- the container- Returns:
- the t
-