|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
Interface for one-to-many relation. There are two types of relations: embedded (when references to the relarted obejcts are stored in relation owner obejct itself) and stanalone (when relation is separate object, which contains the reference to the relation owner and relation members). Both kinds of relations implements Link interface. Embedded relation is created by Storage.createLink method and standalone relation is represented by Relation persistent class created by Storage.createRelation method.
| Method Summary | |
void |
add(IPersistent obj)
Add new object to the relation |
void |
addAll(IPersistent[] arr)
Add all elements of the array to the relation |
void |
addAll(IPersistent[] arr,
int from,
int length)
Add specified elements of the array to the relation |
void |
addAll(Link link)
Add all object members of the other relation to this relation |
void |
clear()
Remove all members from the relation |
boolean |
contains(IPersistent obj)
Check if there is linked object which is equal to the specified object. |
boolean |
containsElement(int i,
IPersistent obj)
Check if i-th element of Link is the same as specified obj |
boolean |
containsObject(IPersistent obj)
Checks if relation contains specified object instance |
IPersistent |
get(int i)
Get related object by index |
IPersistent |
getRaw(int i)
Get related object by index without loading it. |
int |
indexOf(IPersistent obj)
Get index of the specified object in the relation |
void |
insert(int i,
IPersistent obj)
Insert new object in the relation |
java.util.Iterator |
iterator()
Get iterator through link members. |
void |
pin()
Replace references to elements with direct references. |
void |
remove(int i)
Remove object with specified index from the relation |
void |
set(int i,
IPersistent obj)
Replace i-th element of the relation |
void |
setSize(int newSize)
Set number of the linked objects |
int |
size()
Get number of the linked objects |
IPersistent[] |
toArray()
Get relation members as array of object |
IPersistent[] |
toArray(IPersistent[] arr)
Get all relation members as array. |
IPersistent[] |
toRawArray()
Return array with relation members. |
void |
unpin()
Replace all direct references to linked objects with stubs. |
| Methods inherited from interface org.garret.perst.ITable |
select |
| Method Detail |
public void add(IPersistent obj)
obj - object inserted in the relationpublic void addAll(IPersistent[] arr)
arr - array of obects which should be added to the relation
public void addAll(IPersistent[] arr,
int from,
int length)
arr - array of obects which should be added to the relationfrom - index of the first element in the array to be added to the relationlength - number of elements in the array to be added in the relationpublic void addAll(Link link)
link - another relationpublic void clear()
public boolean contains(IPersistent obj)
obj - object to be searched in the index. Object should contain indexed field.
true if collection contains object equals to the specified
public boolean containsElement(int i,
IPersistent obj)
i - element indexobj - object to compare with
true if i-th element of Link reference the same object as "obj"public boolean containsObject(IPersistent obj)
obj - specified object
true if object is present in the collection, false otherwisepublic IPersistent get(int i)
i - index of the object in the relation
public IPersistent getRaw(int i)
equals method
i - index of the object in the relation
public int indexOf(IPersistent obj)
obj - specified object
public void insert(int i,
IPersistent obj)
i - insert poistion, should be in [0,size()]obj - object inserted in the relationpublic java.util.Iterator iterator()
iterator in interface ITablepublic void pin()
public void remove(int i)
i - index in the relartion
public void set(int i,
IPersistent obj)
i - index in the relartionobj - object to be included in the relationpublic void setSize(int newSize)
newSize - new number of linked objects (if it is greater than original number,
than extra elements will be set to null)public int size()
size in interface ITablepublic IPersistent[] toArray()
public IPersistent[] toArray(IPersistent[] arr)
If this index fits in the specified array with room to spare (i.e., the array has more elements than this index), the element in the array immediately following the end of the index is set to null. This is useful in determining the length of this index only if the caller knows that this index does not contain any null elements.)
public IPersistent[] toRawArray()
public void unpin()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||