1 /*
   2  * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javax.xml.soap;
  27 
  28 import java.util.Iterator;
  29 
  30 import javax.xml.namespace.QName;
  31 
  32 /**
  33  * A container for <code>DetailEntry</code> objects. <code>DetailEntry</code>
  34  * objects give detailed error information that is application-specific and
  35  * related to the <code>SOAPBody</code> object that contains it.
  36  *<P>
  37  * A <code>Detail</code> object, which is part of a <code>SOAPFault</code>
  38  * object, can be retrieved using the method <code>SOAPFault.getDetail</code>.
  39  * The <code>Detail</code> interface provides two methods. One creates a new
  40  * <code>DetailEntry</code> object and also automatically adds it to
  41  * the <code>Detail</code> object. The second method gets a list of the
  42  * <code>DetailEntry</code> objects contained in a <code>Detail</code>
  43  * object.
  44  * <P>
  45  * The following code fragment, in which <i>sf</i> is a <code>SOAPFault</code>
  46  * object, gets its <code>Detail</code> object (<i>d</i>), adds a new
  47  * <code>DetailEntry</code> object to <i>d</i>, and then gets a list of all the
  48  * <code>DetailEntry</code> objects in <i>d</i>. The code also creates a
  49  * <code>Name</code> object to pass to the method <code>addDetailEntry</code>.
  50  * The variable <i>se</i>, used to create the <code>Name</code> object,
  51  * is a <code>SOAPEnvelope</code> object.
  52  * <PRE>
  53  *    Detail d = sf.getDetail();
  54  *    Name name = se.createName("GetLastTradePrice", "WOMBAT",
  55  *                                "http://www.wombat.org/trader");
  56  *    d.addDetailEntry(name);
  57  *    Iterator it = d.getDetailEntries();
  58  * </PRE>
  59  *
  60  * @since 1.6
  61  */
  62 public interface Detail extends SOAPFaultElement {
  63 
  64     /**
  65      * Creates a new <code>DetailEntry</code> object with the given
  66      * name and adds it to this <code>Detail</code> object.
  67      *
  68      * @param name a <code>Name</code> object identifying the
  69      *         new <code>DetailEntry</code> object
  70      *
  71      * @exception SOAPException thrown when there is a problem in adding a
  72      * DetailEntry object to this Detail object.
  73      *
  74      * @see Detail#addDetailEntry(QName qname)
  75      */
  76     public DetailEntry addDetailEntry(Name name) throws SOAPException;
  77 
  78     /**
  79      * Creates a new <code>DetailEntry</code> object with the given
  80      * QName and adds it to this <code>Detail</code> object. This method
  81      * is the preferred over the one using Name.
  82      *
  83      * @param qname a <code>QName</code> object identifying the
  84      *         new <code>DetailEntry</code> object
  85      *
  86      * @exception SOAPException thrown when there is a problem in adding a
  87      * DetailEntry object to this Detail object.
  88      *
  89      * @see Detail#addDetailEntry(Name name)
  90      * @since 1.6, SAAJ 1.3
  91      */
  92     public DetailEntry addDetailEntry(QName qname) throws SOAPException;
  93 
  94     /**
  95      * Gets an Iterator over all of the <code>DetailEntry</code>s in this <code>Detail</code> object.
  96      *
  97      * @return an <code>Iterator</code> object over the <code>DetailEntry</code>
  98      *             objects in this <code>Detail</code> object
  99      */
 100     public Iterator getDetailEntries();
 101 }