Oracle Application Server TopLink API Reference
10g Release 2 (10.1.2)

B15903-01


oracle.toplink.ejb.cmp.wls
Interface CursoredCollection

All Superinterfaces:
java.util.Collection, java.io.Serializable

public interface CursoredCollection
extends java.io.Serializable, java.util.Collection

PUBLIC

CursoredCollection is an interface that conforms to Collection while providing Cursor behaviour. This interface is returned from an EJB finder method that uses TopLink CursoredStream support. This is TopLink's way of providing cursored support to EJB2.0 finders. Although all methods are provided, only the following are supported: isEmpty() size() iterator() Example: Execute a finder that reads 150 projects. Read the first 50 as singles, then, read the next 50 in bulk. This simulates a screen paging down.


import oracle.toplink.ejb.cmp.wls.*;
import java.util.*;

CursoredIterator cursoredIterator;
ProjectHome projectHome = getProjectHome();

//begin a transaction. Leave this open until done
getTransaction().begin();

System.out.println("Finding multiple Projects...");
Vector projects = new Vector();
cursoredIterator = (CursoredIterator)projectHome.findByNameCursored("proj%").iterator();
for (int index = 0; index < 50; i++) {

Project project = (Project)cursoredIterator.next();
projects.addElement(project);

}
System.out.println("Get the rest all at once ...");
Vector projectsNext50 = cursoredIterator.next(50);
cursoredIterator.close();

//commit transaction, now that we're done
getTransaction().commit();
See Also:
CursoredStream, CursoredIterator

Method Summary
 boolean add(java.lang.Object objectToAdd)
           Add the provided object to the Collection.
 boolean addAll(java.util.Collection objectsToAdd)
           Add the provided objects to the Collection.
 void clear()
           Removes all of the elements from the Collection.
 boolean contains(java.lang.Object object)
           Returns true if the specified element is contained in the Collection.
 boolean containsAll(java.util.Collection collection)
           Returns true if the specified elements are all contained in the Collection.
 boolean isEmpty()
           Returns true if this Collection contains no elements.
 java.util.Iterator iterator()
           Returns an Iterator which can retrieve the elements contained in this Collection.
 boolean remove(java.lang.Object object)
           If the provided object exists in this Collection, the first match is removed.
 boolean removeAll(java.util.Collection collection)
           Removes any elements from the provided collection that exist in this Collection.
 boolean retainAll(java.util.Collection collection)
           Given the provided collection, remove all elements in this Collection (the receiver) that are NOT contained in the provided collection.
 int size()
           Return the size of this Collection.
 java.lang.Object[] toArray()
           Returns an Array containing all elements in this Collection.
 java.lang.Object[] toArray(java.lang.Object[] array)
           Returns an Array containing all elements in this Collection whose type matches any type in the provided array.

 

Methods inherited from interface java.util.Collection
equals, hashCode

 

Method Detail

add

public boolean add(java.lang.Object objectToAdd)

Add the provided object to the Collection. (not supported, just here for interface)

Specified by:
add in interface java.util.Collection
Parameters:
objectToAdd - Object to add to the collection
Returns:
boolean true if add was successful

addAll

public boolean addAll(java.util.Collection objectsToAdd)

Add the provided objects to the Collection. (not supported, just here for interface)

Specified by:
addAll in interface java.util.Collection
Parameters:
objectsToAdd - Collection of objects to add
Returns:
boolean true if add was successful

clear

public void clear()

Removes all of the elements from the Collection. (not supported, just here for interface)

Specified by:
clear in interface java.util.Collection

contains

public boolean contains(java.lang.Object object)

Returns true if the specified element is contained in the Collection. (not supported, just here for interface)

Specified by:
contains in interface java.util.Collection
Parameters:
object - Object to check for inclusion of
Returns:
boolean true if object is included

containsAll

public boolean containsAll(java.util.Collection collection)

Returns true if the specified elements are all contained in the Collection. (not supported, just here for interface)

Specified by:
containsAll in interface java.util.Collection
Parameters:
collection - Collection of objects to check for inclusion
Returns:
boolean true if all are included

isEmpty

public boolean isEmpty()

Returns true if this Collection contains no elements.

Specified by:
isEmpty in interface java.util.Collection
Returns:
boolean true if empty

iterator

public java.util.Iterator iterator()

Returns an Iterator which can retrieve the elements contained in this Collection.

Specified by:
iterator in interface java.util.Collection
Returns:
Iterator Iterator to iterate over the elements of the receiver

remove

public boolean remove(java.lang.Object object)

If the provided object exists in this Collection, the first match is removed.

Specified by:
remove in interface java.util.Collection
Parameters:
object - Object to remove
Returns:
boolean true if remove was successful
See Also:
Iterator, CursoredIterator

removeAll

public boolean removeAll(java.util.Collection collection)

Removes any elements from the provided collection that exist in this Collection. (not supported, just here for interface)

Specified by:
removeAll in interface java.util.Collection
Parameters:
collection - Collection of objects to remove
Returns:
boolean true if remove was successful

retainAll

public boolean retainAll(java.util.Collection collection)

Given the provided collection, remove all elements in this Collection (the receiver) that are NOT contained in the provided collection. (not supported, just here for interface)

Specified by:
retainAll in interface java.util.Collection
Parameters:
collection - Collection of objects to keep
Returns:
boolean true if no error occurred

size

public int size()

Return the size of this Collection. (not supported, just here for interface)

Specified by:
size in interface java.util.Collection
Returns:
int int indicating size of Collection

toArray

public java.lang.Object[] toArray()

Returns an Array containing all elements in this Collection.

Specified by:
toArray in interface java.util.Collection
Returns:
Object[] Array of the elements of the receiver

toArray

public java.lang.Object[] toArray(java.lang.Object[] array)

Returns an Array containing all elements in this Collection whose type matches any type in the provided array. (not supported, just here for interface)

Specified by:
toArray in interface java.util.Collection
Parameters:
array - Array with types to match receiver's types.
Returns:
Object[] Array of the resultant elements once matched

Copyright © 1998, 2005 Oracle Corporation. All Rights Reserved.