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.persistence.rrd4j.internal;
15 import java.time.ZonedDateTime;
16 import java.time.format.DateTimeFormatter;
17 import java.time.format.FormatStyle;
18 import java.util.Locale;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.openhab.core.persistence.HistoricItem;
22 import org.openhab.core.types.State;
25 * This is a Java bean used to return historic items from a rrd4j database.
27 * @author Kai Kreuzer - Initial contribution
31 public class RRD4jItem implements HistoricItem {
33 private final String name;
34 private final State state;
35 private final ZonedDateTime timestamp;
37 public RRD4jItem(String name, State state, ZonedDateTime timestamp) {
40 this.timestamp = timestamp;
44 public String getName() {
49 public State getState() {
54 public ZonedDateTime getTimestamp() {
59 public String toString() {
61 .format(DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT).withLocale(Locale.getDefault())) + ": "
62 + name + " -> " + state.toString();