|
Java example source code file (NamingEnumeration.java)
The NamingEnumeration.java Java example source code/* * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.naming; import java.util.Enumeration; /** * This interface is for enumerating lists returned by * methods in the javax.naming and javax.naming.directory packages. * It extends Enumeration to allow as exceptions to be thrown during * the enumeration. *<p> * When a method such as list(), listBindings(), or search() returns * a NamingEnumeration, any exceptions encountered are reserved until * all results have been returned. At the end of the enumeration, the * exception is thrown (by hasMore()); * <p> * For example, if the list() is * returning only a partial answer, the corresponding exception would * be PartialResultException. list() would first return a NamingEnumeration. * When the last of the results has been returned by the NamingEnumeration's * next(), invoking hasMore() would result in PartialResultException being thrown. *<p> * In another example, if a search() method was invoked with a specified * size limit of 'n'. If the answer consists of more than 'n' results, * search() would first return a NamingEnumeration. * When the n'th result has been returned by invoking next() on the * NamingEnumeration, a SizeLimitExceedException would then thrown when * hasMore() is invoked. *<p> * Note that if the program uses hasMoreElements() and nextElement() instead * to iterate through the NamingEnumeration, because these methods * cannot throw exceptions, no exception will be thrown. Instead, * in the previous example, after the n'th result has been returned by * nextElement(), invoking hasMoreElements() would return false. *<p> * Note also that NoSuchElementException is thrown if the program invokes * next() or nextElement() when there are no elements left in the enumeration. * The program can always avoid this exception by using hasMore() and * hasMoreElements() to check whether the end of the enumeration has been reached. *<p> * If an exception is thrown during an enumeration, * the enumeration becomes invalid. * Subsequent invocation of any method on that enumeration * will yield undefined results. * * @author Rosanna Lee * @author Scott Seligman * * @see Context#list * @see Context#listBindings * @see javax.naming.directory.DirContext#search * @see javax.naming.directory.Attributes#getAll * @see javax.naming.directory.Attributes#getIDs * @see javax.naming.directory.Attribute#getAll * @since 1.3 */ public interface NamingEnumeration<T> extends Enumeration Other Java examples (source code examples)Here is a short list of links related to this Java NamingEnumeration.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.