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.knx.internal.channel;
15 import static java.util.stream.Collectors.toList;
17 import java.util.List;
18 import java.util.stream.Stream;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.eclipse.jdt.annotation.Nullable;
24 * Data structure representing the content of a channel's group address configuration.
26 * @author Simon Kaufmann - initial contribution and API.
30 public class ChannelConfiguration {
32 private final @Nullable String dpt;
33 private final GroupAddressConfiguration mainGA;
34 private final List<GroupAddressConfiguration> listenGAs;
36 public ChannelConfiguration(@Nullable String dpt, GroupAddressConfiguration mainGA,
37 List<GroupAddressConfiguration> listenGAs) {
40 this.listenGAs = listenGAs;
43 public @Nullable String getDPT() {
47 public GroupAddressConfiguration getMainGA() {
51 public List<GroupAddressConfiguration> getListenGAs() {
52 return Stream.concat(Stream.of(mainGA), listenGAs.stream()).collect(toList());
55 public List<GroupAddressConfiguration> getReadGAs() {
56 return getListenGAs().stream().filter(ga -> ga.isRead()).collect(toList());