1/*
2 * Copyright (c) 2004, 2017, 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
26package javax.xml.soap;
27
28import java.util.Iterator;
29
30import javax.xml.namespace.QName;
31
32/**
33 * A container for {@code DetailEntry} objects. {@code DetailEntry}
34 * objects give detailed error information that is application-specific and
35 * related to the {@code SOAPBody} object that contains it.
36 *<P>
37 * A {@code Detail} object, which is part of a {@code SOAPFault}
38 * object, can be retrieved using the method {@code SOAPFault.getDetail}.
39 * The {@code Detail} interface provides two methods. One creates a new
40 * {@code DetailEntry} object and also automatically adds it to
41 * the {@code Detail} object. The second method gets a list of the
42 * {@code DetailEntry} objects contained in a {@code Detail}
43 * object.
44 * <P>
45 * The following code fragment, in which <i>sf</i> is a {@code SOAPFault}
46 * object, gets its {@code Detail} object (<i>d</i>), adds a new
47 * {@code DetailEntry} object to <i>d</i>, and then gets a list of all the
48 * {@code DetailEntry} objects in <i>d</i>. The code also creates a
49 * {@code Name} object to pass to the method {@code addDetailEntry}.
50 * The variable <i>se</i>, used to create the {@code Name} object,
51 * is a {@code SOAPEnvelope} object.
52 * <pre>{@code
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 */
62public interface Detail extends SOAPFaultElement {
63
64    /**
65     * Creates a new {@code DetailEntry} object with the given
66     * name and adds it to this {@code Detail} object.
67     *
68     * @param name a {@code Name} object identifying the
69     *         new {@code DetailEntry} object
70     *
71     * @return the new {@code DetailEntry} object that was
72     *         created
73     *
74     * @exception SOAPException thrown when there is a problem in adding a
75     * DetailEntry object to this Detail object.
76     *
77     * @see Detail#addDetailEntry(QName qname)
78     */
79    public DetailEntry addDetailEntry(Name name) throws SOAPException;
80
81    /**
82     * Creates a new {@code DetailEntry} object with the given
83     * QName and adds it to this {@code Detail} object. This method
84     * is the preferred over the one using Name.
85     *
86     * @param qname a {@code QName} object identifying the
87     *         new {@code DetailEntry} object
88     *
89     * @return the new {@code DetailEntry} object that was
90     *         created
91     *
92     * @exception SOAPException thrown when there is a problem in adding a
93     * DetailEntry object to this Detail object.
94     *
95     * @see Detail#addDetailEntry(Name name)
96     * @since 1.6, SAAJ 1.3
97     */
98    public DetailEntry addDetailEntry(QName qname) throws SOAPException;
99
100    /**
101     * Gets an Iterator over all of the {@code DetailEntry}s in this {@code Detail} object.
102     *
103     * @return an {@code Iterator} object over the {@code DetailEntry}
104     *             objects in this {@code Detail} object
105     */
106    public Iterator<DetailEntry> getDetailEntries();
107}
108