2 * Copyright (c) 2010-2022 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.lutron.internal.radiora.protocol;
15 import java.util.List;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
20 * Abstract base class for commands.
22 * @author Jeff Lauterbach - Initial Contribution
26 public abstract class RadioRACommand {
28 protected static final String FIELD_SEPARATOR = ",";
29 protected static final String CMD_TERMINATOR = "\r";
31 public abstract String getCommand();
33 public abstract List<String> getArgs();
36 public String toString() {
37 StringBuilder str = new StringBuilder();
39 str.append(getCommand());
41 for (String arg : getArgs()) {
42 str.append(FIELD_SEPARATOR);
46 str.append(CMD_TERMINATOR);
48 return str.toString();