| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| Query |
|
| 1.0;1 |
| 1 | package org.jtheque.core.managers.persistence; | |
| 2 | ||
| 3 | import java.util.Arrays; | |
| 4 | ||
| 5 | /* | |
| 6 | * This file is part of JTheque. | |
| 7 | * | |
| 8 | * JTheque is free software: you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation, either version 3 of the License. | |
| 11 | * | |
| 12 | * JTheque is distributed in the hope that it will be useful, | |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | * GNU General Public License for more details. | |
| 16 | * | |
| 17 | * You should have received a copy of the GNU General Public License | |
| 18 | * along with JTheque. If not, see <http://www.gnu.org/licenses/>. | |
| 19 | */ | |
| 20 | ||
| 21 | /** | |
| 22 | * A query for Spring JDBC. It seems a couple of query and parameters. | |
| 23 | * | |
| 24 | * @author Baptiste Wicht | |
| 25 | */ | |
| 26 | public final class Query { | |
| 27 | private final String sqlQuery; | |
| 28 | private final Object[] parameters; | |
| 29 | ||
| 30 | /** | |
| 31 | * Construct a new Query. | |
| 32 | * | |
| 33 | * @param sqlQuery The SQL Query. | |
| 34 | * @param parameters The parameters of the query. | |
| 35 | */ | |
| 36 | public Query(String sqlQuery, Object[] parameters) { | |
| 37 | 0 | super(); |
| 38 | ||
| 39 | 0 | this.sqlQuery = sqlQuery; |
| 40 | 0 | this.parameters = Arrays.copyOf(parameters, parameters.length); |
| 41 | 0 | } |
| 42 | ||
| 43 | /** | |
| 44 | * Return the SQL Query. | |
| 45 | * | |
| 46 | * @return The SQL Query. | |
| 47 | */ | |
| 48 | public String getSqlQuery() { | |
| 49 | 0 | return sqlQuery; |
| 50 | } | |
| 51 | ||
| 52 | /** | |
| 53 | * Return all the parameters of the query. | |
| 54 | * | |
| 55 | * @return The query parameters. | |
| 56 | */ | |
| 57 | public Object[] getParameters() { | |
| 58 | 0 | return Arrays.copyOf(parameters, parameters.length); |
| 59 | } | |
| 60 | } |