2 * Copyright (c) 2010-2022 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.surepetcare.internal.dto;
15 import java.util.ArrayList;
16 import java.util.List;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
22 * The {@link SurePetcareTopology} is the Java class used to represent a whole Sure Petcare topology. It's used to
23 * deserialize JSON API results.
25 * @author Rene Scherer - Initial contribution
28 public class SurePetcareTopology {
30 public List<SurePetcareDevice> devices = new ArrayList<>();
31 public List<SurePetcareHousehold> households = new ArrayList<>();
32 public List<SurePetcarePet> pets = new ArrayList<>();
33 public List<SurePetcarePhoto> photos = new ArrayList<>();
34 public List<SurePetcareTag> tags = new ArrayList<>();
36 public SurePetcareUser user;
38 public @Nullable <T extends SurePetcareBaseObject> T getById(List<T> elements, String id) {
39 for (T e : elements) {
40 if (id.equals(e.id.toString())) {
48 public String toString() {
49 return "SurePetcareTopology [# of Devices=" + devices.size() + ", # of Households=" + households.size()
50 + ", # of pets=" + pets.size() + "]";