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.miele.internal;
16 * The {@link FullyQualifiedApplianceIdentifier} class represents a fully qualified appliance identifier.
17 * Example: "hdm:ZigBee:0123456789abcdef#210"
19 * @author Jacob Laursen - Initial contribution
21 public class FullyQualifiedApplianceIdentifier {
23 private String protocol;
24 private String applianceId;
26 public FullyQualifiedApplianceIdentifier(String uid) {
29 int separatorPosition = this.uid.lastIndexOf(':') + 1;
30 this.protocol = uid.substring(0, separatorPosition);
31 this.applianceId = uid.substring(separatorPosition);
34 public FullyQualifiedApplianceIdentifier(String applianceId, String protocol) {
35 this.uid = protocol + applianceId;
36 this.protocol = protocol;
37 this.applianceId = applianceId;
41 * @return UID of appliance (e.g. "hdm:ZigBee:0123456789abcdef#210")
43 public String getUid() {
48 * @return Appliance ID without protocol adapter information (e.g. "0123456789abcdef#210")
50 public String getApplianceId() {
51 return this.applianceId;
54 public String getId() {
55 return this.getApplianceId().replaceAll("[^a-zA-Z0-9_]", "_");
59 * @return Protocol prefix of fully qualified appliance identifier (e.g. "hdmi:ZigBee:"")
61 public String getProtocol() {