Package oracle.forms.jdapi
Interface JdapiIterator
- All Superinterfaces:
Iterator
JdapiIterator
extends
java.util.Iterator
. All Jdapi methods returning iterator objects return
this type, regardless of the implementing subclass.
This interface supports the JDK1.3 Iterator
explicitly but also
adds JDK1.3 ListIterator
-style bi-directionality.
The typical way to use JdapiIterator
(as JDK1.3 Iterator
) is:
JdapiIterator items = blk.getItems(); while(items.hasNext()) { Item itm = (Item)items.next(); // do something with Item itm... }Since the methods of
java.util.Iterator
return java.lang.Object
, so do those
of JdapiIterator
. Thus, you must cast to the appropriate return type or
supertype. For example:
// Get the block list from the form module JdapiIterator blocks = myForm.getObjectProperty(JdapiTypes.BLOCK_PTID); Block myBlock = (Block)blocks.next(); System.out.println(myBlock.getStringProperty(JdapiTypes.NAME_PTID)); // Now get the item list from the first block JdapiIterator items = Block.getObjectProperty(JdapiTypes.ITEM_PTID); Item myItem = (Item)items.next(); System.out.println(myBlock.getStringProperty(JdapiTypes.NAME_PTID));This interface includes a
remove()
method because it is part
of the standard implementation of an iterator. Note however, it is not always
possible to remove an item from a list. For more information, see remove
.-
Method Summary
Modifier and TypeMethodDescriptionvoid
goLast()
Moves the iterator to the end of the list.void
goStart()
Moves the iterator to the start of the list.boolean
hasNext()
Returnstrue
if the iteration has more elements.boolean
Returnstrue
if the iteration has a previous element.next()
Returns the next object in the iteration.previous()
Returns the previous object.void
remove()
Removes the current object from the iteration.Methods inherited from interface java.util.Iterator
forEachRemaining
-
Method Details
-
goLast
void goLast()Moves the iterator to the end of the list. Use this method withprevious
if you want to step backwards through a list. -
goStart
void goStart()Moves the iterator to the start of the list. -
hasNext
boolean hasNext()Returnstrue
if the iteration has more elements. -
hasPrevious
boolean hasPrevious()Returnstrue
if the iteration has a previous element.- Returns:
true
if the iteration has a previous element;false
otherwise.
-
next
Object next()Returns the next object in the iteration. -
previous
Object previous()Returns the previous object. Use this method withgoLast
if you want to step backwards through a list.- Returns:
- the previous object in the list, null if there is no previous object.
-
remove
void remove()Removes the current object from the iteration. You cannot call this method twice on the same object in the iteration. This is the method you should use if you want to remove objects from within an iteration and continue to go through the iteration. If you destroy an object in the iteration any other way, the iterator will probably fail.If the iterator is not positioned at the first element of the list, it will position itself there before doing the remove. This allows you to write code like:
while(iter.hasNext()) { iter.remove(); }
Note that in some cases it is not possible to call
remove()
because of the underlying implementation of the list. For example, it is possible to remove a Block from a list of blocks. In contrast, it is not possible to remove a Metaproperty from a list of metaproperties. If you call this method on an object that cannot be removed, then aJdapiException
will be thrown.
-