src/share/classes/com/sun/jndi/toolkit/dir/LazySearchEnumerationImpl.java
Print this page
@@ -45,20 +45,21 @@
import javax.naming.spi.DirectoryManager;
import java.util.NoSuchElementException;
import java.util.Hashtable;
-final public class LazySearchEnumerationImpl implements NamingEnumeration {
- private NamingEnumeration candidates;
+final public class LazySearchEnumerationImpl
+ implements NamingEnumeration<SearchResult> {
+ private NamingEnumeration<Binding> candidates;
private SearchResult nextMatch = null;
private SearchControls cons;
private AttrFilter filter;
private Context context;
- private Hashtable env;
+ private Hashtable<String, Object> env;
private boolean useFactory = true;
- public LazySearchEnumerationImpl(NamingEnumeration candidates,
+ public LazySearchEnumerationImpl(NamingEnumeration<Binding> candidates,
AttrFilter filter, SearchControls cons) throws NamingException {
this.candidates = candidates;
this.filter = filter;
if(cons == null) {
@@ -66,13 +67,14 @@
} else {
this.cons = cons;
}
}
- public LazySearchEnumerationImpl(NamingEnumeration candidates,
+ public LazySearchEnumerationImpl(NamingEnumeration<Binding> candidates,
AttrFilter filter, SearchControls cons,
- Context ctx, Hashtable env, boolean useFactory) throws NamingException {
+ Context ctx, Hashtable<String, Object> env, boolean useFactory)
+ throws NamingException {
this.candidates = candidates;
this.filter = filter;
this.env = env;
this.context = ctx;
@@ -84,13 +86,13 @@
this.cons = cons;
}
}
- public LazySearchEnumerationImpl(NamingEnumeration candidates,
+ public LazySearchEnumerationImpl(NamingEnumeration<Binding> candidates,
AttrFilter filter, SearchControls cons,
- Context ctx, Hashtable env) throws NamingException {
+ Context ctx, Hashtable<String, Object> env) throws NamingException {
this(candidates, filter, cons, ctx, env, true);
}
public boolean hasMore() throws NamingException {
// find and do not remove from list
@@ -103,19 +105,19 @@
} catch (NamingException e) {
return false;
}
}
- public Object nextElement() {
+ public SearchResult nextElement() {
try {
return findNextMatch(true);
} catch (NamingException e) {
throw new NoSuchElementException(e.toString());
}
}
- public Object next() throws NamingException {
+ public SearchResult next() throws NamingException {
// find and remove from list
return (findNextMatch(true));
}
public void close() throws NamingException {
@@ -136,11 +138,11 @@
// need to find next match
Binding next;
Object obj;
Attributes targetAttrs;
while (candidates.hasMore()) {
- next = (Binding)candidates.next();
+ next = candidates.next();
obj = next.getObject();
if (obj instanceof DirContext) {
targetAttrs = ((DirContext)(obj)).getAttributes("");
if (filter.check(targetAttrs)) {
if (!cons.getReturningObjFlag()) {