source: SRUClient/trunk/src/main/java/eu/clarin/sru/client/SRUGenericExtraResponseData.java @ 6938

Last change on this file since 6938 was 6938, checked in by Oliver Schonefeld, 8 years ago
  • fix copyright
  • fix some code formatting
  • fix JavaDoc? warnings
  • Property svn:eol-style set to native
File size: 1.9 KB
Line 
1/**
2 * This software is copyright (c) 2012-2016 by
3 *  - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
4 * This is free software. You can redistribute it
5 * and/or modify it under the terms described in
6 * the GNU General Public License v3 of which you
7 * should have received a copy. Otherwise you can download
8 * it from
9 *
10 *   http://www.gnu.org/licenses/gpl-3.0.txt
11 *
12 * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de)
13 *
14 * @license http://www.gnu.org/licenses/gpl-3.0.txt
15 *  GNU General Public License v3
16 */
17package eu.clarin.sru.client;
18
19import javax.xml.namespace.QName;
20
21import org.w3c.dom.DocumentFragment;
22
23
24/**
25 * A class that provides a generic implementation for
26 * {@link SRUExtraResponseData}. The parsed extra response data made available
27 * by converting it into a DocumentFragment.
28 */
29public class SRUGenericExtraResponseData implements SRUExtraResponseData {
30    private final QName name;
31    private final DocumentFragment fragment;
32
33
34    /**
35     * Constructor.
36     *
37     * @param name
38     *            the root element of this extra response data fragment
39     * @param fragment
40     *            the extra response data fragment as {@link DocumentFragment}
41     */
42    SRUGenericExtraResponseData(QName name, DocumentFragment fragment) {
43        if (name == null) {
44            throw new NullPointerException("name == null");
45        }
46        this.name     = name;
47        if (fragment == null) {
48            throw new NullPointerException("fragment == null");
49        }
50        this.fragment = fragment;
51    }
52
53
54    @Override
55    public QName getRootElement() {
56        return name;
57    }
58
59
60    /**
61     * Get the parsed extra response data as DocumentFragment
62     *
63     * @return the parsed extra response data as DocumentFragment
64     */
65    public DocumentFragment getDocumentFragment() {
66        return fragment;
67    }
68
69} // class SRUGenericExtraResponseData
Note: See TracBrowser for help on using the repository browser.