]> git.basschouten.com Git - openhab-addons.git/blob
8c3127eab36cbe5d19ade51b687947f18daad602
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 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.model;
14
15 import java.time.ZonedDateTime;
16
17 import org.openhab.core.persistence.HistoricItem;
18 import org.openhab.core.types.State;
19
20 /**
21  * Represents the data on the part of openHAB.
22  *
23  * @author Helmut Lehmeyer - Initial contribution
24  */
25 public class JdbcHistoricItem implements HistoricItem {
26
27     private final String name;
28     private final State state;
29     private final ZonedDateTime timestamp;
30
31     public JdbcHistoricItem(String name, State state, ZonedDateTime timestamp) {
32         this.name = name;
33         this.state = state;
34         this.timestamp = timestamp;
35     }
36
37     @Override
38     public String getName() {
39         return name;
40     }
41
42     @Override
43     public State getState() {
44         return state;
45     }
46
47     @Override
48     public ZonedDateTime getTimestamp() {
49         return timestamp;
50     }
51
52     @Override
53     public String toString() {
54         StringBuilder builder = new StringBuilder();
55         builder.append("JdbcItem [name=");
56         builder.append(name);
57         builder.append(", state=");
58         builder.append(state);
59         builder.append(", timestamp=");
60         builder.append(timestamp);
61         builder.append("]");
62         return builder.toString();
63     }
64 }