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.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.openhab.core.persistence.HistoricItem;
21 import org.openhab.core.types.State;
24 * This is a Java bean used to return historic items from a rrd4j database.
26 * @author Kai Kreuzer - Initial contribution
29 public class RRD4jItem implements HistoricItem {
31 private final String name;
32 private final State state;
33 private final ZonedDateTime timestamp;
35 public RRD4jItem(String name, State state, ZonedDateTime timestamp) {
38 this.timestamp = timestamp;
42 public String getName() {
47 public State getState() {
52 public ZonedDateTime getTimestamp() {
57 public String toString() {
59 .format(DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT).withLocale(Locale.getDefault())) + ": "
60 + name + " -> " + state.toString();