mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-16 18:24:36 +00:00
Updating for requester filter and to be able to have multiple calls for
any type of device.
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>com.bwssystems.HABridge</groupId>
|
||||
<artifactId>ha-bridge</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<version>3.5.1a</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>HA Bridge</name>
|
||||
|
||||
@@ -1,10 +1,28 @@
|
||||
package com.bwssystems.HABridge.api;
|
||||
|
||||
public class CallItem {
|
||||
private String type;
|
||||
private String requesterAddress;
|
||||
private String item;
|
||||
private Integer count;
|
||||
private Integer delay;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getRequesterAddress() {
|
||||
return requesterAddress;
|
||||
}
|
||||
|
||||
public void setRequesterAddress(String requesterAddress) {
|
||||
this.requesterAddress = requesterAddress;
|
||||
}
|
||||
|
||||
public String getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.bwssystems.HABridge.api;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
public class CallItemDeserializer implements JsonDeserializer<CallItem> {
|
||||
@Override
|
||||
public CallItem deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext ctx)
|
||||
{
|
||||
CallItem aCallItem = new CallItem();
|
||||
JsonObject jsonObj = json.getAsJsonObject();
|
||||
JsonElement jsonElem;
|
||||
jsonElem = jsonObj.get("item");
|
||||
aCallItem.setItem(jsonElem.getAsString());
|
||||
jsonElem = jsonObj.get("delay");
|
||||
aCallItem.setDelay(jsonElem.getAsInt());
|
||||
jsonElem = jsonObj.get("count");
|
||||
aCallItem.setCount(jsonElem.getAsInt());
|
||||
return aCallItem;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user