Skip to content

Instantly share code, notes, and snippets.

@e3oroush
Created July 13, 2019 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save e3oroush/d4fb377facb62650d17846a39ce49a51 to your computer and use it in GitHub Desktop.
Save e3oroush/d4fb377facb62650d17846a39ce49a51 to your computer and use it in GitHub Desktop.
Simple JAVA class for device and temperature
package mypackage.events;
public class Sensor {
private int deviceId;
private double temperature;
private long timestamp;
public Sensor(int deviceId, double temperature, long timestamp)
{
this.deviceId = deviceId;
this.temperature = temperature;
this.timestamp = timestamp;
}
public int getDeviceId() {
return deviceId;
}
public void setDeviceId(int deviceId) {
this.deviceId = deviceId;
}
public double getTemperature() {
return temperature;
}
public void setTemperature(double temperature) {
this.temperature = temperature;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
@Override
public String toString() {
return "device id: " + this.deviceId + ", temperature: " + this.temperature;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment