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.digitalstrom.internal.lib.event.types;
15 import java.util.LinkedList;
16 import java.util.List;
18 import com.google.gson.JsonArray;
19 import com.google.gson.JsonObject;
22 * The {@link JSONEventImpl} is the implementation of the {@link Event}.
24 * @author Alexander Betker
26 public class JSONEventImpl implements Event {
28 private List<EventItem> eventItemList;
31 * Creates a new {@link JSONEventImpl} from the given digitalSTROM-Event {@link JsonArray}.
33 * @param jsonEventArray must not be null
35 public JSONEventImpl(JsonArray jsonEventArray) {
36 this.eventItemList = new LinkedList<>();
37 for (int i = 0; i < jsonEventArray.size(); i++) {
38 if (jsonEventArray.get(i) instanceof JsonObject) {
39 this.eventItemList.add(new EventItemImpl((JsonObject) jsonEventArray.get(i)));
45 public List<EventItem> getEventItems() {