]> git.basschouten.com Git - openhab-addons.git/blob
352b90ffb76f25a10aa71c699f2b0ddac72f0da6
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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.vigicrues.internal.dto.opendatasoft;
14
15 import java.time.ZoneId;
16 import java.util.Arrays;
17 import java.util.Optional;
18
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.eclipse.jdt.annotation.Nullable;
21
22 /**
23  * The {@link Parameters} 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 Parameters {
30     private String[] dataset = {};
31     private String timezone = "";
32     private int rows;
33     private String format = "";
34     private @Nullable Refine refine;
35     private String[] facet = {};
36
37     public Optional<String> getDataset() {
38         return Arrays.stream(dataset).findFirst();
39     }
40
41     public ZoneId getTimezone() {
42         return ZoneId.of(timezone);
43     }
44
45     public int getRows() {
46         return rows;
47     }
48
49     public String getFormat() {
50         return format;
51     }
52
53     public Optional<Refine> getRefine() {
54         Refine refine = this.refine;
55         if (refine != null) {
56             return Optional.of(refine);
57         }
58         return Optional.empty();
59     }
60
61     public String[] getFacets() {
62         return facet;
63     }
64 }