public interface Handle extends Iterable<Property>
What's important is that collection property type allows iteration thanks to (Iterable).
| Modifier and Type | Method and Description |
|---|---|
Property |
add(Property... properties)
Adds one or multiple properties to collection property.
|
Property |
add(String path,
Property... properties)
Adds one or multiple properties to collection property, that exists under given
path. |
CollectionProperty |
asCollection() |
EntityProperty |
asEntity() |
RefProperty |
asRef() |
ValueProperty |
asValue() |
Property |
at(int index)
Gets property at given
index withing this property. |
boolean |
booleanValue() |
boolean |
booleanValue(String path)
Gets value as boolean from given
path. |
Property |
clear()
Clear all children of
this property. |
Property |
create() |
default Property |
find(long id)
Find child property by id.
|
Property |
get(String path)
Gets property under given
path. |
Boolean |
getBoolean() |
Boolean |
getBoolean(String path)
Gets value as Boolean from given
path. |
CollectionProperty |
getCollection(String path)
Find collection property based on given
path within this property subtree. |
Date |
getDate() |
Date |
getDate(String path)
Gets value as Date from given
path. |
Date |
getDatetime() |
Date |
getDatetime(String path)
Gets value as Date with time from given
path. |
BigDecimal |
getDecimal() |
BigDecimal |
getDecimal(String path)
Gets value as BigDecimal from given
path. |
ElementType |
getElementType()
Gets associated element type, based on property implementation.
|
Property |
getEntity(String path)
Find entity property based on given
path within this property subtree. |
ValueHolder |
getHolder() |
ValueHolder |
getHolder(String path)
Gets value of property wrapped into
ValueHolder from given path. |
Integer |
getInteger() |
Integer |
getInteger(String path)
Gets value as Integer from given
path. |
Long |
getLong() |
Long |
getLong(String path)
Gets value as Long from given
path. |
double |
getNumber() |
double |
getNumber(String path)
Gets value as double from given
path. |
int |
getRefCount()
Number of nodes referencing target's property.
|
Property |
getRefTarget()
Gets property of reference's target.
|
EntityState |
getState()
Gets state of property.
|
String |
getString() |
String |
getString(String path)
Gets value as String from given
path. |
default boolean |
has(String path)
Checks if this property has element of given
path. |
int |
intValue() |
int |
intValue(String path)
Gets value as int from given
path. |
default boolean |
isCollection()
Is property a collection type.
|
default boolean |
isEntity()
Is property an entity.
|
boolean |
isPersistent()
Is property in persistent state.
|
default boolean |
isRef()
Is property a reference type.
|
default boolean |
isRoot()
Is property a root element.
|
boolean |
isTransient()
Is property in transient state.
|
default boolean |
isValue()
Is property a value type.
|
String |
print()
Creates whole sub tree of this property as formatted String.
|
Property |
remove()
Removes itself.
|
Property |
remove(String path)
Removes property from given
path. |
void |
set(Object value)
Sets new
value of this property. |
Property |
set(String path,
Object value)
Sets new
value under given path, which must exists. |
int |
size() |
void |
traverse(PropertyVisitor visitor)
This method walks on property subtree and invoke some action with
PropertyVisitor. |
void |
traverse(PropertyVisitor visitor,
boolean usePathsInVisitor)
Deprecated.
This method will be removed in the future. New implementation is not using paths to resolve subtree.
|
forEach, iterator, spliteratorProperty get(String path)
path. There are few path resolving possibilities:
1. Direct access to child property (element, reference, value or collection)
property.get("child") - direct child property
property.get("children") - direct children collection property
property.get("child.name") - indirect child's name property as value
2. Access to collection element at available index
property.get("children.id") - is not possible, if "children" is collection property
property.get("children[0].id") - proper access to child, that exists within children collection
3. Chain of properties
property.get("supplier.car.model.productionYear")
If path is empty or null, property should return itself.path - should exists within this propertyset(String, Object)Property set(String path, Object value)
value under given path, which must exists. All rules of path design, are the same as described in get(String).
Property agent = property.get("agent").set("age", 31).set("name", "steph");
This method is useful for setting up multiple properties of one parent property, in the sense of Builder Pattern.path - should exists within this propertyvalue - new value for path.get(String)void set(Object value)
value of this property.value - new valuedefault Property find(long id)
id - child idProperty getEntity(String path)
path within this property subtree.
All rules of path design, are the same as described in get(String).path - of entity propertyget(String),
EntityPropertyCollectionProperty getCollection(String path)
path within this property subtree.
All rules of path design, are the same as described in get(String).path - of collection propertyCollectionPropertyElementType getElementType()
ElementType.get(String)default boolean isEntity()
false. Adequate subclasses should provide custom implementation.EntityPropertydefault boolean isValue()
false. Adequate subclasses should provide custom implementation.ValuePropertydefault boolean isCollection()
false. Adequate subclasses should provide custom implementation.CollectionPropertydefault boolean isRoot()
false.Adequate subclasses should provide custom implementation.BundleValueProperty asValue()
ValuePropertyEntityProperty asEntity()
EntityPropertyCollectionProperty asCollection()
CollectionPropertyRefProperty asRef()
RefPropertyvoid traverse(PropertyVisitor visitor)
PropertyVisitor. Think of it as Visitor Pattern.visitor - propertyPropertyVisitor@Deprecated void traverse(PropertyVisitor visitor, boolean usePathsInVisitor)
PropertyVisitor. Think of it as Visitor Pattern.
Control flag usePathsInVisitor allows to switch between new and old way of resolving subtree. The outcome should be the same to the API user.
If set to true, the old way will be used. If set to false, the new mechanism will be used.visitor - propertyusePathsInVisitor - control flag if it should use paths to walk over subtreePropertyVisitorString print()
Property add(String path, Property... properties)
path.
The order of properties should be kept as they are provided. If there are properties added to collection property, which resides under this path,
they should be added at the end.
All rules of path design, are the same as described in get(String).path - to collection propertyproperties - one or multiple properties that will be addedpathget(String)Property add(Property... properties)
properties - one or multiple properties that will be addedthis propertyProperty remove(String path)
path.
Property will first be detached from whole subtree, like collections and references. If that is possible, then property will be removed.
All rules of path design, are the same as described in get(String).path - points to property, that will be removedget(String)Property remove()
Property clear()
this property.int size()
Property at(int index)
index withing this property.
Index starts with 0.index > size of elements within propertyindex - of element within propertyProperty create()
default boolean has(String path)
path.falsepath - of element to be checkedtrue, if property has element with path, false otherwisedefault boolean isRef()
false.false otherwiseProperty getRefTarget()
nullint getRefCount()
boolean isPersistent()
boolean isTransient()
EntityState getState()
EntityState.TRANSIENT - if property was just created and not yet marked for persistenceEntityState.PERSISTENT - if property was marked for persistence by BundleServicePersistenceMarker docs.PersistenceMarker,
BundleServiceValueHolder getHolder(String path)
ValueHolder from given path.
All rules of path design, are the same as described in get(String).path - to valueValueHolderget(String)ValueHolder getHolder()
ValueHolderString getString(String path)
path.
All rules of path design, are the same as described in get(String).path - to valueget(String)String getString()
Integer getInteger(String path)
path.
All rules of path design, are the same as described in get(String).path - to valueget(String)Integer getInteger()
BigDecimal getDecimal(String path)
path.
All rules of path design, are the same as described in get(String).path - to valueget(String)BigDecimal getDecimal()
Long getLong(String path)
path.
All rules of path design, are the same as described in get(String).path - to valueget(String)Long getLong()
Boolean getBoolean(String path)
path.
All rules of path design, are the same as described in get(String).path - to valueget(String)Boolean getBoolean()
Date getDate(String path)
path.
All rules of path design, are the same as described in get(String).path - to valueget(String)Date getDate()
Date getDatetime(String path)
path.
All rules of path design, are the same as described in get(String).path - to valueget(String)Date getDatetime()
double getNumber(String path)
path.
All rules of path design, are the same as described in get(String).path - to valueget(String)double getNumber()
int intValue(String path)
path.
All rules of path design, are the same as described in get(String).path - to valueget(String)int intValue()
boolean booleanValue(String path)
path.
All rules of path design, are the same as described in get(String).path - to valueget(String)boolean booleanValue()
Copyright © 2021. All rights reserved.