source: SRUServer/trunk/src/main/java/eu/clarin/sru/server/SRUQueryBase.java @ 7269

Last change on this file since 7269 was 7269, checked in by Oliver Schonefeld, 2 years ago
  • Update copyright
  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1/**
2 * This software is copyright (c) 2011-2022 by
3 *  - Leibniz-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 Leibniz-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.server;
18
19/**
20 * Base class for implementing for a parsed query to be returned from a
21 * {@link SRUQueryParser}.
22 *
23 * @param <T>
24 *            abstract syntax tree (object) for parsed queries.
25 */
26public abstract class SRUQueryBase<T> implements SRUQuery<T> {
27    protected final String rawQuery;
28    protected final T parsedQuery;
29
30
31    /**
32     * Constructor.
33     *
34     * @param rawQuery
35     *            the raw and unparsed query as String
36     * @param parsedQuery
37     *            the query parsed into an abstract syntax tree object
38     */
39    protected SRUQueryBase(String rawQuery, T parsedQuery) {
40        if (rawQuery == null) {
41            throw new NullPointerException("rawQuery == null");
42        }
43        this.rawQuery = rawQuery;
44        if (parsedQuery == null) {
45            throw new NullPointerException("parsedQuery == null");
46        }
47        this.parsedQuery = parsedQuery;
48    }
49
50
51    @Override
52    public String getRawQuery() {
53        return rawQuery;
54    }
55
56
57    @Override
58    public T getParsedQuery() {
59        return parsedQuery;
60    }
61
62} // abstract class SRUQueryBase
Note: See TracBrowser for help on using the repository browser.