public class Bundle extends EntityProperty
BundleDef definition.
Bundle stores basic information like:
Bundle bundle = new Bundle(def); // def must match properties that are setup later
Property steph = bundle.create("Client").set("age", 31).set("name", "steph");
Property dean = bundle.create("Client").set("age", 32).set("name", "dean");
Property alex = bundle.create("Client").set("age", 33).set("name", "alex");
bundle.get("agent").set(steph);
bundle.get("policy.insurer").set(dean);
bundle.get("policy.insured").set(alex);
Bundle can be used with Hyperon context mechanism. The best way to do that is to work with AppCtx.
| Constructor and Description |
|---|
Bundle(BundleDef def)
Basic constructor to use with definition.
|
Bundle(BundleDef def,
long id)
Shouldn't be used outside of Hyperon persistence engine.
|
Bundle(BundleDef def,
long id,
int revision)
Shouldn't be used outside of Hyperon persistence engine.
|
Bundle(BundleDef def,
long id,
int revision,
int expectedSize)
Shouldn't be used outside of Hyperon persistence engine.
|
| Modifier and Type | Method and Description |
|---|---|
Bundle |
add(String name,
Property prop)
Adds given
property under provided name. |
boolean |
contains(Property prop)
Checks if given
prop property exists within bundle. |
Property |
create(String type)
Create instance of property, that matches given
type name from associated bundle definition. |
Bundle |
deepcopy()
Same as
deepcopy(boolean), but with flag set to true. |
Bundle |
deepcopy(boolean resetIds)
Creates new bundle instance with copied:
all bundle data
internal fields
references
It applies to all nested properties within bundle root.
|
boolean |
equals(Object o) |
Set<Property> |
getAll()
Get all properties within bundle.
|
Date |
getCreated()
Get bundle's creation time.
|
BundleDef |
getDef()
Get bundle's definition.
|
int |
getLobHash()
Get last lob hash.
|
int |
getRevision()
Get bundle's revision.
|
Date |
getUpdated()
Get bundle's last update time
|
int |
hashCode() |
IdentitySet |
identitySet()
Returns identity set with nested properties.
|
boolean |
isNotSaved()
Checks if bundle was not saved yet.
|
boolean |
isRoot()
Since bundle is always a root, it will return
true. |
boolean |
isSaved()
Checks if bundle was saved already.
|
String |
print()
This will print bundle with specific format.
|
Property |
remove()
This method is not supported.
|
void |
setCreated(Date created)
Shouldn't be used outside of Hyperon persistence engine.
|
void |
setLobHash(int lobHash)
Shouldn't be used outside of Hyperon persistence engine.
|
void |
setRevision(int revision)
Shouldn't be used outside of Hyperon persistence engine.
|
void |
setUpdated(Date updated)
Shouldn't be used outside of Hyperon persistence engine.
|
String |
toString()
Formatted String as follows:
EntityProperty[name#23, @432423432, owner=101, fields=field1, refc=2]
|
void |
walk(PropertyVisitor visitor)
This method allows to walk on each property using provided
visitor and do some action. |
void |
walk(PropertyVisitor visitor,
boolean usePathsInVisitor)
Deprecated.
this method shouldn't be used anymore. Please use
walk(PropertyVisitor). |
create, find, getElementType, getFields, getId, getProp, getState, getValue, has, isEntity, mark, print, printValues, resetIds, set, setBundle, setId, sizeadd, add, asCollection, asEntity, asRef, asValue, at, booleanValue, booleanValue, bundle, clear, 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, isTransient, isValue, iterator, remove, set, setContainer, setName, setOwnerId, setParent, setupOwnerId, traverse, traverseforEach, spliteratorpublic Bundle(BundleDef def)
def - bundle definitionpublic Bundle(BundleDef def, long id)
def - bundle definitionid - bundle idpublic Bundle(BundleDef def, long id, int revision)
def - bundle definitionid - bundle idrevision - bundle revision starting numberpublic Bundle(BundleDef def, long id, int revision, int expectedSize)
def - bundle definitionid - bundle idrevision - bundle revision starting numberexpectedSize - size of created identity setpublic Bundle add(String name, Property prop)
property under provided name.
It is another way of setting properties within bundle.add in class EntityPropertyname - unique nameprop - property to store under nameEntityProperty.set(Object),
Property.set(String, Object)public boolean isRoot()
true.public int getRevision()
public void setRevision(int revision)
revision - revision numberpublic Date getCreated()
public void setCreated(Date created)
created - creation datepublic Date getUpdated()
public void setUpdated(Date updated)
updated - update datepublic void setLobHash(int lobHash)
lobHash - lob hashpublic int getLobHash()
public BundleDef getDef()
public boolean isNotSaved()
public boolean isSaved()
public Property create(String type)
type name from associated bundle definition.type - from bundle definitionHyperonPersistenceException - if type is not defined within bundle definitionpublic IdentitySet identitySet()
IdentityScanner usage.
This method shouldn't be used to access elements of bundle and especially modify it's content.IdentityScannerpublic boolean contains(Property prop)
prop property exists within bundle.prop - property to checkpublic Bundle deepcopy(boolean resetIds)
true.deepcopy in class EntityPropertyresetIds - control flag, if true then bundle and all elements will have id's set to 0, if false, id will be copiedProperty.deepcopy()public Bundle deepcopy()
deepcopy(boolean), but with flag set to true.public boolean equals(Object o)
equals in class EntityPropertypublic int hashCode()
hashCode in class EntityPropertypublic void walk(PropertyVisitor visitor)
visitor and do some action.visitor - property visitor implementationPropertyVisitor.visit(Property, ElementType)@Deprecated public void walk(PropertyVisitor visitor, boolean usePathsInVisitor)
walk(PropertyVisitor).visitor - property visitor implementationusePathsInVisitor - control flag, if set to true it will trigger new implementation, false the old one.public Property remove()
remove in interface Handleremove in class PropertyUnsupportedOperationException - this is not supported on root bundle levelpublic String print()
bundle D: Bundle[id=0, revision=0]
* agent (Client#0 @60861)
- pesel = null (string)
* age = 11 (integer)
* policy (Policy#0 @12577)
* building (Building#0 @23246)
* area = 99 (integer)
* clients collection(Client) size=1
* clients[0] (Client#0 @31764)
- addr (Address#0 @49659)
print in interface Handleprint in class PropertyProperty,
ValueProperty,
EntityProperty,
CollectionProperty,
RefPropertypublic String toString()
EntityProperty
EntityProperty[name#23, @432423432, owner=101, fields=field1, refc=2]
toString in class EntityPropertyCopyright © 2021. All rights reserved.