]> git.basschouten.com Git - openhab-addons.git/blob
69e5a72c1e2da6d41ec8ccbccb3b7eabfff43e65
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.persistence.jdbc.internal.dto;
14
15 import java.time.ZonedDateTime;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.core.persistence.HistoricItem;
19 import org.openhab.core.types.State;
20
21 /**
22  * Represents the data on the part of openHAB.
23  *
24  * @author Helmut Lehmeyer - Initial contribution
25  */
26 @NonNullByDefault
27 public class JdbcHistoricItem implements HistoricItem {
28
29     private final String name;
30     private final State state;
31     private final ZonedDateTime timestamp;
32
33     public JdbcHistoricItem(String name, State state, ZonedDateTime timestamp) {
34         this.name = name;
35         this.state = state;
36         this.timestamp = timestamp;
37     }
38
39     @Override
40     public String getName() {
41         return name;
42     }
43
44     @Override
45     public State getState() {
46         return state;
47     }
48
49     @Override
50     public ZonedDateTime getTimestamp() {
51         return timestamp;
52     }
53
54     @Override
55     public String toString() {
56         StringBuilder builder = new StringBuilder();
57         builder.append("JdbcItem [name=");
58         builder.append(name);
59         builder.append(", state=");
60         builder.append(state);
61         builder.append(", timestamp=");
62         builder.append(timestamp);
63         builder.append("]");
64         return builder.toString();
65     }
66 }