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.bticinosmarther.internal.api.dto;
15 import static org.openhab.binding.bticinosmarther.internal.SmartherBindingConstants.NAME_SEPARATOR;
17 import java.util.List;
18 import java.util.stream.Collectors;
20 import org.eclipse.jdt.annotation.Nullable;
23 * The {@code Modules} class defines the dto for Smarther API list of modules.
25 * @author Fabio Possieri - Initial contribution
27 public class Modules {
29 private List<Module> modules;
32 * Returns the list of modules contained in this object.
34 * @return the list of modules
36 public @Nullable List<Module> getModules() {
41 * Converts a list of {@link Module} objects into a string containing the module names, comma separated.
44 * the list of module objects to be converted, may be {@code null}
46 * @return a string containing the comma separated module names, or {@code null} if the list is {@code null} or
49 public static @Nullable String toNameString(@Nullable List<Module> modules) {
50 if (modules == null || modules.isEmpty()) {
53 return modules.stream().map(a -> a.getName()).collect(Collectors.joining(NAME_SEPARATOR));