public class DataUtils extends Object
NestableData
format.Modifier and Type | Class and Description |
---|---|
static class |
DataUtils.BundlePathError |
Constructor and Description |
---|
DataUtils() |
Modifier and Type | Method and Description |
---|---|
static <N extends NestableData<N>> |
delete(N item,
String path)
XPath-like method for deleting the value of a nested relation's
attribute.
|
static <N extends NestableData<N>> |
deleteItem(N item,
String path)
XPath-like method for deleting a node from a nested tree, i.e:
|
static <T,N extends NestableData<N>> |
get(N item,
String path)
XPath-like method for getting the value of a nested relation's attribute.
|
static <N extends NestableData<N>> |
getItem(N item,
String path)
XPath-like method for getting a item at a given path.
|
static <N extends NestableData<N>> |
getRelations(N item,
String path)
Xpath-like method to fetch a set of nested relations.
|
static <T,N extends NestableData<N>> |
set(N item,
String path,
T value)
Xpath-like method for creating a new item by updating a nested relation
of an existing item.
|
static <N extends NestableData<N>> |
setItem(N item,
String path,
N newItem)
Xpath-like method for creating a new item by updating a nested relation
of an existing item.
|
public static <T,N extends NestableData<N>> T get(N item, String path)
String lang = DataUtils.get(item, "describes[0]/languageCode"));
T
- the type to fetchitem
- the itempath
- a path stringpublic static <N extends NestableData<N>> N getItem(N item, String path)
Bundle description = DataUtils.getItem(item, "describes[0]"));
item
- the itempath
- a path stringpublic static <N extends NestableData<N>> N delete(N item, String path)
Bundle newBundle = DataUtils.delete(item, "describes[0]/languageCode"));
item
- the itempath
- a path stringpublic static <N extends NestableData<N>> N deleteItem(N item, String path)
Bundle newBundle = DataUtils.deleteItem(item, "describes[0]"));
item
- the itempath
- a path stringpublic static <T,N extends NestableData<N>> N set(N item, String path, T value)
Bundle newBundle = DataUtils.set(oldBundle, "hasDate[0]/startDate", "1923-10-10");
T
- the type of property being setitem
- the itempath
- a path stringvalue
- the value being setpublic static <N extends NestableData<N>> N setItem(N item, String path, N newItem)
Bundle dateBundle = ...
Bundle newItem = DataUtils.setItem(oldBundle, "hasDate[0]", dateBundle);
Use an index of -1 to create a relationship set or append to an existing one.
item
- the itempath
- a path stringnewItem
- the new item to set at the pathpublic static <N extends NestableData<N>> List<N> getRelations(N item, String path)
List<Bundle> dates = DataUtils.getRelations(item, "hasDate");
item
- the itempath
- a path stringCopyright © 2018 The European Holocaust Research Infrastructure (EHRI). All rights reserved.