public class CollectionProperty extends Property
TypeDef.
All methods, which are accessing nested list, must follow this rule:
0 <= index < list.size().
Two collections of type CollectionProperty are equal in the sense of
equals and hashCode, if their nested list are equals.| Constructor and Description |
|---|
CollectionProperty(EntityType entityType)
Creates
CollectionProperty for provided compound entityType. |
CollectionProperty(TypeDef type)
Creates
CollectionProperty for provided type definition. |
| Modifier and Type | Method and Description |
|---|---|
CollectionProperty |
add(int index,
Property property)
Attach given
property at provided index. |
CollectionProperty |
add(int index,
Property property,
boolean checkRef)
Attach given
property at provided index. |
CollectionProperty |
add(Property... properties)
Adds multiple properties in given order using
add(Property). |
CollectionProperty |
add(Property property)
Attach given
property at the end. |
CollectionProperty |
add(Property property,
boolean checkRef)
Attach given
property at the end. |
Property |
at(int index)
Gets property at given
index withing this property. |
Property |
clear()
Clear all children of
this property. |
Property |
create()
Creates new property of
EntityProperty with compound type matching collection supported type. |
Property |
deepcopy(boolean resetIds)
Creates defensive copies of collection property and it's property elements.
|
boolean |
equals(Object o) |
Property |
find(long id)
Search for element with id within collection and it's subtree.
|
ElementType |
getElementType()
Gets associated element type, based on property implementation.
|
long |
getId() |
List<Property> |
getList() |
int |
hashCode() |
boolean |
isCollection()
Is property a collection type.
|
Iterator<Property> |
iterator()
.
|
void |
mark()
Marks collection property
state to EntityState.PERSISTENT. |
void |
print(StringBuilder sb,
int level,
String prefix,
String suffix)
Adds to
sb formatted String, specific for ValueProperty, which looks like:
* covers collection(Cover) size=2
* covers[0] (Cover#1003 @21133) refc=1
* code = CA (string)
* premium = 100 (number)
* su = 10000 (number)
* covers[1] (Cover#1004 @45743) refc=1
* code = CB (string)
* premium = 200 (number)
* su = 20000 (number)
|
void |
resetIds()
Resets owner id and reset ids on each property element from
list. |
CollectionProperty |
set(int index,
Property property)
Attach given
property at provided index. |
void |
set(Object value)
value must be of type CollectionProperty, then all elements of this value will be added to this CollectionProperty
instance. |
int |
size() |
Property[] |
toArray()
Creates snapshot array
|
String |
toString()
Formatted String as follows:
CollectionProperty[collection1 (MyType) size=1]
|
add, asCollection, asEntity, asRef, asValue, booleanValue, booleanValue, bundle, deepcopy, get, getBoolean, getBoolean, getBundle, getCanonicalPath, getCollection, getContainer, getDate, getDate, getDatetime, getDatetime, getDecimal, getDecimal, getEntity, getHolder, getHolder, getInteger, getInteger, getLong, getLong, getName, getNumber, getNumber, getOwnerId, getOwnerPropertyName, getParent, getParentName, getPath, getRefCount, getRefTarget, getState, getString, getString, getType, getTypeCode, intValue, intValue, isEntity, isPersistent, isRoot, isTransient, isValue, print, remove, remove, set, setContainer, setName, setOwnerId, setParent, setupOwnerId, traverse, traverseforEach, spliteratorpublic CollectionProperty(TypeDef type)
CollectionProperty for provided type definition.type - definitionTypeDefpublic CollectionProperty(EntityType entityType)
CollectionProperty for provided compound entityType.entityType - compound typepublic CollectionProperty add(Property property)
property at the end.
Check if given property is already in tree, then creates reference to property and adds it to collection.property - to addadd(Property...),
add(int, Property)public CollectionProperty add(Property property, boolean checkRef)
property at the end.
Check if given property is already in tree and checkRef == true, then creates reference to property and adds it to collection.property - to addcheckRef - indicates whether add mechanism should check if given property is already in bundle. If yes, then ref property is createdpublic CollectionProperty add(int index, Property property)
property at provided index.
Check if given property is already in tree, then creates reference to property and adds it to collection.index - in which given property should be addedproperty - to addadd(Property),
add(Property...)public CollectionProperty add(int index, Property property, boolean checkRef)
property at provided index.
Check if given property is already in tree and checkRef == true, then creates reference to property and adds it to collection.index - index in which given property should be addedproperty - to addcheckRef - indicates whether add mechanism should check if given property is already in bundle. If yes, then ref property is createdpublic CollectionProperty set(int index, Property property)
property at provided index.
Previous node will be removed from collections at index position.index - index at which property should be replacedproperty - property to put at indexIndexOutOfBoundsException - if index is greater then size of collectionadd(int, Property)public void mark()
state to EntityState.PERSISTENT.public CollectionProperty add(Property... properties)
add(Property).add in interface Handleadd in class Propertyproperties - to addadd(Property)public int size()
public Property at(int index)
index withing this property.
Index starts with 0.
index is smaller then 0 or exceeds list size, then exception will be throw.at in interface Handleat in class Propertyindex - index to retrieve element fromHyperonPersistenceUsageException - if index is not available for listpublic Property clear()
this property.
public void set(Object value)
value must be of type CollectionProperty, then all elements of this value will be added to this CollectionProperty
instance. Otherwise exception will be thrown.set in interface Handleset in class Propertyvalue - to be usedHyperonPersistenceUsageException - if value is not instance of CollectionPropertypublic Property create()
EntityProperty with compound type matching collection supported type.public Property find(long id)
id - child idpublic ElementType getElementType()
HandleElementType.COLLECTION element typeHandle.get(String)public Property deepcopy(boolean resetIds)
resetIds.deepcopy in class PropertyresetIds - whether to reset ids on copyCollectionPropertyProperty.deepcopy()public void resetIds()
list.public void print(StringBuilder sb, int level, String prefix, String suffix)
sb formatted String, specific for ValueProperty, which looks like:
* covers collection(Cover) size=2
* covers[0] (Cover#1003 @21133) refc=1
* code = CA (string)
* premium = 100 (number)
* su = 10000 (number)
* covers[1] (Cover#1004 @45743) refc=1
* code = CB (string)
* premium = 200 (number)
* su = 20000 (number)
print in class Propertysb - StringBuilder containing data to printlevel - level used to indentationprefix - value to used as prefixsuffix - value to used as suffixtoString()public boolean isCollection()
PropertyisCollection in interface HandleisCollection in class PropertytrueCollectionPropertypublic String toString()
CollectionProperty[collection1 (MyType) size=1]
public Property[] toArray()
Copyright © 2021. All rights reserved.