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.velux.internal.things;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.velux.internal.VeluxBindingConstants;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
21 * <B>Velux</B> product characteristics: Product Reference.
23 * Combined set of information which describes a current state of a single Velux product.
25 * Methods in handle this type of information:
27 * <LI>{@link #getProductName()} to retrieve the name representing this actuator/product.</LI>
28 * <LI>{@link #getProductType()} to retrieve the type of the product.</LI>
29 * <LI>{@link #toString} to retrieve a human-readable description of the product state.</LI>
33 * @author Guenther Schreiner - initial contribution.
36 public class VeluxProductReference {
37 private final Logger logger = LoggerFactory.getLogger(VeluxProductReference.class);
41 private final VeluxProductName name;
42 private final VeluxProductType typeId;
47 * Initializes the {@link VeluxProductReference} based on a given {@link VeluxProduct} and its associated type.
50 * @param name as {@link VeluxProductName} referencing to a specific actuator/product.
51 * @param type as int as handled by {@link VeluxProductType#get(int)}.
53 public VeluxProductReference(VeluxProductName name, int type) {
55 this.typeId = VeluxProductType.get(type);
56 if (this.typeId == VeluxProductType.UNDEFTYPE) {
58 "Please report this to maintainer of the {} binding: VeluxProductReference({}) has found an unregistered ProductTypeId.",
59 VeluxBindingConstants.BINDING_ID, type);
63 // Class access methods
65 public VeluxProductName getProductName() {
69 public VeluxProductType getProductType() {
74 public String toString() {
75 return String.format("Prod.ref. \"%s\"/%s", this.name, this.typeId);