public class EntityProperty extends Property
* key -> field name, which is case sensitive
* value -> another Property - subtype of {@link Property}
Basic API methods:
add(String, Property)getProp(String)EntityType| Constructor and Description |
|---|
EntityProperty(EntityType entityType)
Creates entity (complex) property based on given
entityType. |
EntityProperty(long id,
EntityType entityType)
Creates entity (complex) property with id, based on given
entityType. |
| Modifier and Type | Method and Description |
|---|---|
EntityProperty |
add(String name,
Property prop)
Adds given
property under provided name. |
Property |
create() |
Property |
deepcopy(boolean resetIds)
Returns deep copy of this property's subtree.
|
boolean |
equals(Object o) |
Property |
find(long id)
Find child property by id.
|
ElementType |
getElementType()
Gets associated element type, based on property implementation.
|
Map<String,Property> |
getFields() |
long |
getId() |
Property |
getProp(String name)
Gets property based on given
name. |
EntityState |
getState()
Gets state of property.
|
ValueProperty |
getValue(String name)
Gets
ValueProperty based on given name. |
boolean |
has(String path)
Checks if this property has element of given
path. |
int |
hashCode() |
boolean |
isEntity()
Is property an entity.
|
void |
mark()
Marks entity property to
EntityState.PERSISTENT. |
void |
print(StringBuilder sb,
int level,
String prefix,
String suffix)
Prints subtree to string builder.
|
String |
printValues()
Creates formatted String.
|
void |
resetIds()
Reset ids.
|
void |
set(Object value)
Sets new
value of this property. |
void |
setBundle(Bundle bundle)
Sets bundle for property.
|
void |
setId(long id)
Sets id.
|
int |
size() |
String |
toString()
Formatted String as follows:
EntityProperty[name#23, @432423432, owner=101, fields=field1, refc=2]
|
add, add, asCollection, asEntity, asRef, asValue, at, booleanValue, booleanValue, bundle, clear, 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, getString, getString, getType, getTypeCode, intValue, intValue, isCollection, isPersistent, isRoot, isTransient, isValue, iterator, print, remove, remove, set, setContainer, setName, setOwnerId, setParent, setupOwnerId, traverse, traverseforEach, spliteratorpublic EntityProperty(EntityType entityType)
entityType.entityType - complex entity typesEntityTypepublic EntityProperty(long id,
EntityType entityType)
entityType.id - for propertyentityType - complex entity typesEntityTypepublic EntityProperty add(String name, Property prop)
property under provided name. Name is case sensitive.
If there is already some property under this name, then new prop will override previous property.
If provided property is CollectionProperty, then all it's children will also have mapped parent to this.name - unique nameprop - property to store under nameEntityProperty instanceset(Object)public void setBundle(Bundle bundle)
bundle - root for parameterpublic Map<String,Property> getFields()
public Property getProp(String name)
name.name - of fieldgetValue(String)public ValueProperty getValue(String name)
ValueProperty based on given name.
It may throw cast exception, if property of name is not type of ValueProperty.name - of fieldgetProp(String)public void setId(long id)
id - for propertypublic ElementType getElementType()
HandleElementType.ENTITY element typeHandle.get(String)public boolean isEntity()
PropertyisEntity in interface HandleisEntity in class PropertytrueEntityPropertypublic Property deepcopy(boolean resetIds)
deepcopy in class PropertyresetIds - control flag, if true then property and all elements will have their id set to 0, if false, id will be copiedEntityPropertyProperty.deepcopy()public void resetIds()
fields.public void print(StringBuilder sb, int level, String prefix, String suffix)
public String printValues()
EntityProperty[entityName#123, owner=44, values={field1=test}]
public int size()
public Property create()
Propertycreate in interface Handlecreate in class PropertyEntityProperty based on this compound type definition.public boolean has(String path)
path.
path - of element to be checkedpublic void set(Object value)
value of this property..
public Property find(long id)
id - child idpublic 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.getState in interface HandlegetState in class PropertyPersistenceMarker,
BundleServicepublic void mark()
EntityState.PERSISTENT.Copyright © 2021. All rights reserved.