src/share/classes/com/sun/jndi/toolkit/dir/ContextEnumerator.java
Print this page
@@ -31,14 +31,14 @@
/**
* A class for recursively enumerating the contents of a Context;
*
* @author Jon Ruiz
*/
-public class ContextEnumerator implements NamingEnumeration {
+public class ContextEnumerator implements NamingEnumeration<Binding> {
private static boolean debug = false;
- private NamingEnumeration children = null;
+ private NamingEnumeration<Binding> children = null;
private Binding currentChild = null;
private boolean currentReturned = false;
private Context root;
private ContextEnumerator currentChildEnum = null;
private boolean currentChildExpanded = false;
@@ -75,11 +75,11 @@
rootProcessed = !returnSelf;
prepNextChild();
}
// Subclass should override if it wants to avoid calling obj factory
- protected NamingEnumeration getImmediateChildren(Context ctx)
+ protected NamingEnumeration<Binding> getImmediateChildren(Context ctx)
throws NamingException {
return ctx.listBindings("");
}
// Subclass should overrride so that instance is of same type as subclass
@@ -99,19 +99,19 @@
} catch (NamingException e) {
return false;
}
}
- public Object nextElement() {
+ public Binding nextElement() {
try {
return next();
} catch (NamingException e) {
throw new NoSuchElementException(e.toString());
}
}
- public Object next() throws NamingException {
+ public Binding next() throws NamingException {
if (!rootProcessed) {
rootProcessed = true;
return new Binding("", root.getClass().getName(),
root, true);
}
@@ -130,11 +130,11 @@
private boolean hasMoreChildren() throws NamingException {
return children != null && children.hasMore();
}
private Binding getNextChild() throws NamingException {
- Binding oldBinding = ((Binding)children.next());
+ Binding oldBinding = children.next();
Binding newBinding = null;
// if the name is relative, we need to add it to the name of this
// context to keep it relative w.r.t. the root context we are
// enumerating
@@ -190,11 +190,11 @@
} else if (currentChildExpanded && currentChildEnum.hasMore()) {
if(debug) {System.out.println("getNextDescedant: expanded case");}
// if the current child is expanded, use it's enumerator
- return (Binding)currentChildEnum.next();
+ return currentChildEnum.next();
} else {
// Ready to go onto next child
if(debug) {System.out.println("getNextDescedant: next case");}