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 TypeMethodDescriptionvoidgoLast()Moves the iterator to the end of the list.voidgoStart()Moves the iterator to the start of the list.booleanhasNext()Returnstrueif the iteration has more elements.booleanReturnstrueif the iteration has a previous element.next()Returns the next object in the iteration.previous()Returns the previous object.voidremove()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 withpreviousif you want to step backwards through a list. -
goStart
void goStart()Moves the iterator to the start of the list. -
hasNext
boolean hasNext()Returnstrueif the iteration has more elements. -
hasPrevious
boolean hasPrevious()Returnstrueif the iteration has a previous element.- Returns:
trueif the iteration has a previous element;falseotherwise.
-
next
Object next()Returns the next object in the iteration. -
previous
Object previous()Returns the previous object. Use this method withgoLastif 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 aJdapiExceptionwill be thrown.
-