1 /* 2 * @(#)ExceptionList.java 1.25 03/12/19 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 8 package org.omg.CORBA; 9 10 /** 11 * An object used in <code>Request</code> operations to 12 * describe the exceptions that can be thrown by a method. It maintains a 13 * modifiable list of <code>TypeCode</code>s of the exceptions. 14 * <P> 15 * The following code fragment demonstrates creating 16 * an <code>ExceptionList</code> object: 17 * <PRE> 18 * ORB orb = ORB.init(args, null); 19 * org.omg.CORBA.ExceptionList excList = orb.create_exception_list(); 20 * </PRE> 21 * The variable <code>excList</code> represents an <code>ExceptionList</code> 22 * object with no <code>TypeCode</code> objects in it. 23 * <P> 24 * To add items to the list, you first create a <code>TypeCode</code> object 25 * for the exception you want to include, using the <code>ORB</code> method 26 * <code>create_exception_tc</code>. Then you use the <code>ExceptionList</code> 27 * method <code>add</code> to add it to the list. 28 * The class <code>ExceptionList</code> has a method for getting 29 * the number of <code>TypeCode</code> objects in the list, and after 30 * items have been added, it is possible to call methods for accessing 31 * or deleting an item at a designated index. 32 * 33 * @version 1.13, 09/09/97 34 * @since JDK1.2 35 */ 36 37 public abstract class ExceptionList { 38 39 /** 40 * Retrieves the number of <code>TypeCode</code> objects in this 41 * <code>ExceptionList</code> object. 42 * 43 * @return the number of <code>TypeCode</code> objects in this 44 * <code>ExceptionList</code> object 45 */ 46 47 public abstract int count(); 48 49 /** 50 * Adds a <code>TypeCode</code> object describing an exception 51 * to this <code>ExceptionList</code> object. 52 * 53 * @param exc the <code>TypeCode</code> object to be added 54 */ 55 56 public abstract void add(TypeCode exc); 57 58 /** 59 * Returns the <code>TypeCode</code> object at the given index. The first 60 * item is at index 0. 61 * 62 * @param index the index of the <code>TypeCode</code> object desired. 63 * This must be an <code>int</code> between 0 and the 64 * number of <code>TypeCode</code> objects 65 * minus one, inclusive. 66 * @return the <code>TypeCode</code> object at the given index 67 * @exception org.omg.CORBA.Bounds if the index given is greater than 68 * or equal to the number of <code>TypeCode</code> objects 69 * in this <code>ExceptionList</code> object 70 */ 71 72 public abstract TypeCode item(int index) 73 throws org.omg.CORBA.Bounds; 74 75 /** 76 * Removes the <code>TypeCode</code> object at the given index. 77 * Note that the indices of all the <code>TypeCoded</code> objects 78 * following the one deleted are shifted down by one. 79 * 80 * @param index the index of the <code>TypeCode</code> object to be 81 * removed. 82 * This must be an <code>int</code> between 0 and the 83 * number of <code>TypeCode</code> objects 84 * minus one, inclusive. 85 * 86 * @exception org.omg.CORBA.Bounds if the index is greater than 87 * or equal to the number of <code>TypeCode</code> objects 88 * in this <code>ExceptionList</code> object 89 */ 90 91 public abstract void remove(int index) 92 throws org.omg.CORBA.Bounds; 93 } 94