]> git.basschouten.com Git - openhab-addons.git/blob
60ddd50f5ce13becbc422eaa0c128e25d4352a04
[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.robonect.internal.model;
14
15 import com.google.gson.annotations.SerializedName;
16
17 /**
18  * The super class of all answers from the robonect module. All answersd derive from this class. An answer is either
19  * successful where all the information of the subclass will be filled, or it is not successful, and this class will
20  * hold the error information.
21  * 
22  * @author Marco Meyer - Initial contribution
23  */
24 public class RobonectAnswer {
25
26     private boolean successful;
27
28     @SerializedName("error_code")
29     private Integer errorCode;
30
31     @SerializedName("error_message")
32     private String errorMessage;
33
34     /**
35      * @return - true if the request was successful, false otherwise.
36      */
37     public boolean isSuccessful() {
38         return successful;
39     }
40
41     /**
42      * allows to set the successful status for testing.
43      * 
44      * @param successful
45      */
46     public void setSuccessful(boolean successful) {
47         this.successful = successful;
48     }
49
50     /**
51      * @return - in case of a not successful request, the error code, null otherwise.
52      */
53     public Integer getErrorCode() {
54         return errorCode;
55     }
56
57     /**
58      * @return - in case of a not successful request, the error message, null otherwise.
59      */
60     public String getErrorMessage() {
61         return errorMessage;
62     }
63 }