]> git.basschouten.com Git - openhab-addons.git/blob
54119fcbacff15f759f96bc00f8414b32a8a2bfa
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.meteoalerte.internal.json;
14
15 import java.util.Optional;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19
20 import com.google.gson.annotations.SerializedName;
21
22 /**
23  * The {@link ApiResponse} is the Java class used to map the JSON
24  * response to the webservice request.
25  *
26  * @author GaĆ«l L'hopital - Initial contribution
27  */
28 @NonNullByDefault
29 public class ApiResponse {
30     @SerializedName("nhits")
31     private int nHits;
32     private @Nullable Parameters parameters;
33     private Record[] records = {};
34
35     public int getNHits() {
36         return nHits;
37     }
38
39     public Optional<Parameters> getParameters() {
40         Parameters parameters = this.parameters;
41         if (parameters != null) {
42             return Optional.of(parameters);
43         }
44         return Optional.empty();
45     }
46
47     public Record[] getRecords() {
48         return records;
49     }
50 }