2 * Copyright (c) 2010-2023 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;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
18 * The {@link FullyQualifiedApplianceIdentifier} class represents a fully qualified appliance identifier.
19 * Example: "hdm:ZigBee:0123456789abcdef#210"
21 * @author Jacob Laursen - Initial contribution
24 public class FullyQualifiedApplianceIdentifier {
26 private String protocol;
27 private String applianceId;
29 public FullyQualifiedApplianceIdentifier(String uid) {
32 int separatorPosition = this.uid.lastIndexOf(':') + 1;
33 this.protocol = uid.substring(0, separatorPosition);
34 this.applianceId = uid.substring(separatorPosition);
37 public FullyQualifiedApplianceIdentifier(String applianceId, String protocol) {
38 this.uid = protocol + applianceId;
39 this.protocol = protocol;
40 this.applianceId = applianceId;
44 * @return UID of appliance (e.g. "hdm:ZigBee:0123456789abcdef#210")
46 public String getUid() {
51 * @return Appliance ID without protocol adapter information (e.g. "0123456789abcdef#210")
53 public String getApplianceId() {
54 return this.applianceId;
57 public String getId() {
58 return this.getApplianceId().replaceAll("[^a-zA-Z0-9_]", "_");
62 * @return Protocol prefix of fully qualified appliance identifier (e.g. "hdmi:ZigBee:")
64 public String getProtocol() {