]> git.basschouten.com Git - openhab-addons.git/blob
1442f0752ed4b1e66488a621359b0aa79dfc67ef
[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.mpd.internal.protocol;
14
15 import java.util.ArrayList;
16 import java.util.List;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19
20 /**
21  * Class for encapsulating an MPD response
22  *
23  * @author Stefan Röllin - Initial contribution
24  */
25
26 @NonNullByDefault
27 public class MPDResponse {
28     private final String command;
29     private final List<String> lines = new ArrayList<>();
30     private boolean failed = false;
31
32     public MPDResponse(String command) {
33         this.command = command;
34     }
35
36     public void addLine(String line) {
37         lines.add(line);
38     }
39
40     public String getCommand() {
41         return command;
42     }
43
44     public List<String> getLines() {
45         return lines;
46     }
47
48     public boolean isOk() {
49         return !failed;
50     }
51
52     public void setFailed() {
53         failed = true;
54     }
55 }