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.io.neeo.internal.models;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
19 * This class represents a directory position (within an overall list of items). This class is simply used for
20 * serialization and deserialization with the NEEO Brain.
22 * @author Tim Roberts - Initial Contribution
26 public class NeeoDirectoryRequest {
27 /** The offset position within the overall list */
28 private final int offset;
30 /** The limit (total items) for this position */
31 private final int limit;
33 /** The browse identifier identifying this position */
35 private final String browseIdentifier;
38 * Constructs the position from the given parameters
40 * @param offset a non-negative offset
41 * @param limit a non-negative limit
42 * @param browseIdentifier a potentially null, potentially empty browse identifier
44 public NeeoDirectoryRequest(int offset, int limit, @Nullable String browseIdentifier) {
46 throw new IllegalArgumentException("offset cannot be negative");
49 throw new IllegalArgumentException("limit cannot be negative");
53 this.browseIdentifier = browseIdentifier;
57 * The offset for this position
59 * @return the offset (>= 0)
61 public int getOffset() {
66 * The limit for this position
68 * @return the limit (>= 0)
70 public int getLimit() {
75 * The browse identifier
77 * @return a potentially null, potentially empty browse identifier
80 public String getBrowseIdentifier() {
81 return browseIdentifier;
85 public String toString() {
86 return "NeeoDiscoveryListResultPosition [offset=" + offset + ", limit=" + limit + ", browseIdentifier="
87 + browseIdentifier + "]";