]> git.basschouten.com Git - openhab-addons.git/blob
7a2e8128fc69739c1d9b6f07706e6d0fafaa3aef
[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 /* This file is based on:
14  *
15  * ResponseListener
16  * Connect SDK
17  *
18  * Copyright (c) 2014 LG Electronics.
19  * Created by Hyun Kook Khang on 19 Jan 2014
20  *
21  * Licensed under the Apache License, Version 2.0 (the "License");
22  * you may not use this file except in compliance with the License.
23  * You may obtain a copy of the License at
24  *
25  *     http://www.apache.org/licenses/LICENSE-2.0
26  *
27  * Unless required by applicable law or agreed to in writing, software
28  * distributed under the License is distributed on an "AS IS" BASIS,
29  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30  * See the License for the specific language governing permissions and
31  * limitations under the License.
32  */
33
34 package org.openhab.binding.lgwebos.internal.handler.core;
35
36 import org.eclipse.jdt.annotation.NonNullByDefault;
37
38 /**
39  * Generic asynchronous operation response success handler block. If there is any response data to be processed, it will
40  * be provided via the responseObject parameter.
41  *
42  * @author Hyun Kook Khang - Connect SDK initial contribution
43  * @author Sebastian Prehn - Adoption for openHAB
44  */
45 @NonNullByDefault
46 public interface ResponseListener<T> {
47
48     /**
49      * Returns the success of the call of type T.
50      * Contains the output data as a generic object reference.
51      * This value may be any of a number of types as defined by T in subclasses of ResponseListener.
52      *
53      * @param responseObject Response object, can be any number of object types, depending on the
54      *            protocol/capability/etc
55      */
56     void onSuccess(T responseObject);
57
58     /**
59      * Method to return the error message that was generated.
60      *
61      */
62     void onError(String message);
63 }