2 * Copyright (c) 2010-2020 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.text.DateFormat;
16 import java.time.ZonedDateTime;
18 import org.openhab.core.persistence.HistoricItem;
19 import org.openhab.core.types.State;
22 * This is a Java bean used to return historic items from a rrd4j database.
24 * @author Kai Kreuzer - Initial contribution
27 public class RRD4jItem implements HistoricItem {
29 private final String name;
30 private final State state;
31 private final ZonedDateTime timestamp;
33 public RRD4jItem(String name, State state, ZonedDateTime timestamp) {
36 this.timestamp = timestamp;
40 public String getName() {
45 public State getState() {
50 public ZonedDateTime getTimestamp() {
55 public String toString() {
56 return DateFormat.getDateTimeInstance().format(timestamp) + ": " + name + " -> " + state.toString();