public static interface Data.Single extends ResolvableToSingle<DataEntity,DataEntity.Update>
| Modifier and Type | Method and Description |
|---|---|
StructuredData |
data(RelativePath dataPath)
Returns the data on the path relative to the entity.
|
DataEntity |
entity()
Loads the data entity on the current position in the inventory traversal along with its data.
|
default boolean |
exists()
Similar to
ResolvableToSingle.entity() but merely checks whether the entity exists on the position in the inventory
traversal. |
StructuredData |
flatData(RelativePath dataPath)
This is very similar to
data(RelativePath) but this method doesn't load the child data. |
void |
update(DataEntity.Update update)
Updates the entity.
|
deleteDataEntity entity() throws EntityNotFoundException
Note that this might be a potentially expensive operation because of the attached data structure being loaded.
entity in interface ResolvableToSingle<DataEntity,DataEntity.Update>EntityNotFoundException - if there is no structured data on the current position in the inventoryResolvableToSingle.entity()StructuredData data(RelativePath dataPath)
I.e if you have an data entity which contains a map with a key "foo", which contains a list and you
want to obtain a third element of that list, you'd do:
...data(RelativePath.to().structuredData().key("foo").index(2).get());
If you want to obtain the whole data structure, use an empty path: RelativePath.empty().get().
dataPath - the path to the subset of the data.flatData(RelativePath)StructuredData flatData(RelativePath dataPath)
data(RelativePath) but this method doesn't load the child data.
If the data on the path contains a "primitive" value, the value is loaded. If the data contains a list, the returned instance will contain an empty list and if the data contains a map the returned instance will contain an empty map.
dataPath - the path to the subset of the data to returndefault boolean exists()
ResolvableToSingleResolvableToSingle.entity() but merely checks whether the entity exists on the position in the inventory
traversal.
Note that the default implementation might not be optimal performance-wise because it tries to fully resolve
the entity using the ResolvableToSingle.entity() method but discards that result right after.
exists in interface ResolvableToSingle<DataEntity,DataEntity.Update>void update(DataEntity.Update update) throws EntityNotFoundException, RelationNotFoundException, ValidationException
ResolvableToSingleupdate in interface ResolvableToSingle<DataEntity,DataEntity.Update>update - the update to be appliedEntityNotFoundException - if there is no entity corresponding to the traversalRelationNotFoundException - if there is no relation corresponding to the traversalValidationExceptionCopyright © 2015 Red Hat, Inc.. All rights reserved.