|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Read only, immutable PIM version of java.util.Collection, which can only handle PIM objects (Catalog, Category, Item, Hierarchy, Spec, LookupTable etc)
Implements a "lazy lookup", for performance reasons. This means that the collection keeps hold of objects by their internal ID only, and does not try to resolve the ID to a real object until the last possible moment.
The advantage here is greater performance, the cost is that in a large dynamic system, the contents of the collection may actuallly be different, for example if an object has been deleted since the collection was created.
This means that the behaviour of this class is different than java.util.Collection.
IMPORTANT WARNING: This collection provides a moment in time view of the collection, which will allow you to access those objects in the collection for as long as they still exist in the underlying database. If underlying objects change, you may experience unexpected results, such as fewer iterations than expected, or nulls where you did not expect them.
Also, toArray() is not recommended for general use due to performance reasons, it will resolve every object in the Collection. It will be VERY slow on large collections We recommend using PIMCollection.iterator() instead
Field Summary | |
---|---|
static java.lang.String |
copyright
|
Method Summary | |
---|---|
boolean |
add(java.lang.Object o)
Unsupported method. |
boolean |
addAll(java.util.Collection c)
Unsupported method. |
void |
clear()
Unsupported method |
boolean |
contains(java.lang.Object o)
Check if the object o is in the collection. |
boolean |
containsAll(java.util.Collection c)
Check if all the contents of Collection c are within this PIMCollection. |
boolean |
equals(java.lang.Object o)
|
int |
hashCode()
|
java.util.Iterator |
iterator()
Iterates over the objects in this Collection. |
boolean |
remove(java.lang.Object o)
Unsupported method. |
boolean |
removeAll(java.util.Collection c)
Unsupported method |
boolean |
retainAll(java.util.Collection c)
Unsupported method |
int |
size()
This will return the size of the collection at the time it is created, regardless of whether all the objects can be resolved. |
java.lang.Object[] |
toArray()
Retrieves the whole collection as an array. |
java.lang.Object[] |
toArray(java.lang.Object[] a)
Unsupported method. |
Methods inherited from interface java.util.Collection |
---|
isEmpty |
Field Detail |
public static final java.lang.String copyright
Method Detail |
public int size()
size
in interface java.util.Collection
Collection.size()
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection
o
- the object to check for presence in the collection
java.lang.NullPointerException
- if o is null
PIMInternalException
- if the object is not a valid PIM object type*
public java.util.Iterator iterator()
iterator
in interface java.util.Collection
Collection.iterator()
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection
Collection.toArray()
public java.lang.Object[] toArray(java.lang.Object[] a)
This method will not work, because you cannot change the type of a PIM Object
toArray
in interface java.util.Collection
java.lang.ArrayStoreException
- This exception will be thrown in all conditions.Collection.toArray(java.lang.Object[])
public boolean add(java.lang.Object o)
add
in interface java.util.Collection
java.lang.UnsupportedOperationException
- This exception will be thrown in all conditions.Collection.add(java.lang.Object)
public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection
java.lang.UnsupportedOperationException
- This exception will be thrown in all conditions.Collection.remove(java.lang.Object)
public boolean containsAll(java.util.Collection c)
containsAll
in interface java.util.Collection
c
- the collection to check against this collection
java.lang.NullPointerException
- if c is null or c contains a null entry
PIMInternalException
- if c contains an object which is not a valid PIM ObjectCollection.containsAll(java.util.Collection)
public boolean addAll(java.util.Collection c)
addAll
in interface java.util.Collection
java.lang.UnsupportedOperationException
- This exception will be thrown in all conditions.Collection.addAll(java.util.Collection)
public boolean removeAll(java.util.Collection c)
removeAll
in interface java.util.Collection
java.lang.UnsupportedOperationException
- This exception will be thrown in all conditions.Collection.removeAll(java.util.Collection)
public boolean retainAll(java.util.Collection c)
retainAll
in interface java.util.Collection
java.lang.UnsupportedOperationException
- This exception will be thrown in all conditions.Collection.retainAll(java.util.Collection)
public void clear()
clear
in interface java.util.Collection
java.lang.UnsupportedOperationException
- This exception will be thrown in all conditions.Collection.clear()
public boolean equals(java.lang.Object o)
equals
in interface java.util.Collection
Checks that the PIMCollection *appears* to contains the ojbects as
another PIMCollection It uses its hashcode method to check for equality -
which checks only the underlying ID and does not take into account the
contents of the underlying objects.
This means that an object could be changed or deleted in one of the
collections and equals() would still return true. It also means that
there is no guarantee that all the objects in one collection exist in the
second.
If you need to be certain about the contents of every element, you will
need to use .iterator() or .toArray() See the javadoc on those methods
for caveats on each of those methods.
public int hashCode()
hashCode
in interface java.util.Collection
A shallow hashcode method which only looks at which objects were in this
collection at the time of its creation. It does not look into each
object's contents and does not take into account edits or deletions. It
will always return the same value for the life of this PIMCollection
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |