1 | /** |
---|
2 | * This software is copyright (c) 2012-2014 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 | */ |
---|
17 | package eu.clarin.sru.client; |
---|
18 | |
---|
19 | import javax.xml.namespace.QName; |
---|
20 | |
---|
21 | import 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 | */ |
---|
29 | public class SRUGenericExtraResponseData implements SRUExtraResponseData { |
---|
30 | private final QName name; |
---|
31 | private final DocumentFragment fragment; |
---|
32 | |
---|
33 | |
---|
34 | SRUGenericExtraResponseData(QName name, DocumentFragment fragment) { |
---|
35 | if (name == null) { |
---|
36 | throw new NullPointerException("name == null"); |
---|
37 | } |
---|
38 | this.name = name; |
---|
39 | if (fragment == null) { |
---|
40 | throw new NullPointerException("fragment == null"); |
---|
41 | } |
---|
42 | this.fragment = fragment; |
---|
43 | } |
---|
44 | |
---|
45 | |
---|
46 | @Override |
---|
47 | public QName getRootElement() { |
---|
48 | return name; |
---|
49 | } |
---|
50 | |
---|
51 | |
---|
52 | /** |
---|
53 | * Get the parsed extra response data as DocumentFragment |
---|
54 | * |
---|
55 | * @return the parsed extra response data as DocumentFragment |
---|
56 | */ |
---|
57 | public DocumentFragment getDocumentFragment() { |
---|
58 | return fragment; |
---|
59 | } |
---|
60 | |
---|
61 | } // class SRUGenericExtraResponseData |
---|