Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

oracle.javatools.db
Class DBObjectIterator

java.lang.Object
  extended by oracle.javatools.db.DBObjectIterator
All Implemented Interfaces:
java.util.Iterator<DBObject>

public class DBObjectIterator
extends java.lang.Object
implements java.util.Iterator<DBObject>

A class for iterating over owned object lists. This iterator implementation takes a parent iterator of DBObjects (could be a SchemaObjectIterator) and iterates over their owned objects finding objects of given type(s). For example:

   final SchemaObjectIterator parentIter = new SchemaObjectIterator( pro );
   parentIter.setTypes( Table.TYPE );
   final DBObjectIterator iter = new DBObjectIterator( parentIter );
   iter.setTypes( Column.TYPE );
   while( iter.hasNext() )
   {
     // iterate over every column in every table in the provider.
   }
 
This iterator is not synchronized, only use on one thread.

Since:
11.1.1.1.0

Constructor Summary
DBObjectIterator(DBObject parent)
          Creates a new DBObjectIterator that will search for children of the given object.
DBObjectIterator(java.util.Iterator<? extends DBObject> parentIter)
          Creates a new DBObjectIterator over all the objects in the parent Iterator.
 
Method Summary
static java.util.Iterator<? extends DBObject> createIterator(DBObjectProvider[] pros, java.lang.String[] schemaObjectTypes, java.lang.String[]... childTypeHeirachy)
          Creates an Iterator of DBObjects for a specific type heirachy of child objects.
static java.util.Iterator<? extends DBObject> createIterator(DBObject parent, java.lang.String[]... childTypeHeirachy)
          Creates an iterator of the children of the given parent object using the childTypeHeirachy to restrict the objects returned.
 boolean hasNext()
           
 DBObject next()
           
 void remove()
          Not supported by this iterator.
 void setTypes(java.lang.String... types)
          Restricts the iterator to only the given object types.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBObjectIterator

public DBObjectIterator(DBObject parent)
Creates a new DBObjectIterator that will search for children of the given object.

Parameters:
parent - the parent object to iterate over the children of.

DBObjectIterator

public DBObjectIterator(java.util.Iterator<? extends DBObject> parentIter)
Creates a new DBObjectIterator over all the objects in the parent Iterator. This iterator will search for children of the objects in the parent Iterator.

Parameters:
parentIter - the iterator of objects this iterator will search the children of
Method Detail

setTypes

public void setTypes(java.lang.String... types)
Restricts the iterator to only the given object types.


hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator<DBObject>

next

public DBObject next()
Specified by:
next in interface java.util.Iterator<DBObject>

remove

public void remove()
Not supported by this iterator.

Specified by:
remove in interface java.util.Iterator<DBObject>
Throws:
java.lang.UnsupportedOperationException

createIterator

public static final java.util.Iterator<? extends DBObject> createIterator(DBObjectProvider[] pros,
                                                                          java.lang.String[] schemaObjectTypes,
                                                                          java.lang.String[]... childTypeHeirachy)
Creates an Iterator of DBObjects for a specific type heirachy of child objects. A type heirachy might be simply new String[]{ Column.TYPE } in which case a normal DBObjectIterator could be created using the appropriate SchemaObjectIterator as a parent. For more complicated heirachies of depth > 1 this method will create the appropriate SchemaObjectIterator and DBObjectIterator classes and return a wrapping Iterator.

For example, the following call will return an iterator over all of the IndexObjects owned by all the Indexes in all the Tables or Materialized Views available in all the given providers:

   DBObjectIterator.createIterator(
     providers,
     new String[]{ Table.TYPE, MaterializedView.TYPE },
     new String[]{ Index.TYPE, IndexObject.TYPE } );
  

Parameters:
pros - all the providers to search in
schemaObjectTypes - all the top level (schema objects) in the providers to search (null for all)
childTypeHeirachy - the heirachy of child types to iterate through. The final element in the array is the type of object ultimately returned by the iterator.
Returns:
an iterator over all the available objects

createIterator

public static final java.util.Iterator<? extends DBObject> createIterator(DBObject parent,
                                                                          java.lang.String[]... childTypeHeirachy)
Creates an iterator of the children of the given parent object using the childTypeHeirachy to restrict the objects returned.


Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

Copyright © 1997, 2011, Oracle. All rights reserved.