All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.minijax.jndi.MinijaxNameClassPairEnumeration Maven / Gradle / Ivy

The newest version!
package org.minijax.jndi;

import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;

import javax.naming.NameClassPair;
import javax.naming.NamingEnumeration;

public class MinijaxNameClassPairEnumeration implements NamingEnumeration {
    private final Iterator> iterator;

    public MinijaxNameClassPairEnumeration(final Map data) {
        this.iterator = data.entrySet().iterator();
    }

    @Override
    public NameClassPair next() {
        final Entry entry = iterator.next();
        return new NameClassPair(entry.getKey().toString(), entry.getValue().getClass().getName());
    }

    @Override
    public boolean hasMore() {
        return iterator.hasNext();
    }

    @Override
    public void close() {
        // Nothing to do
    }

    @Override
    public NameClassPair nextElement() {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean hasMoreElements() {
        throw new UnsupportedOperationException();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy