tuya-connector helps you efficiently create cloud development projects regarding the OpenAPI or message subscription capabilities. You can put all the focus on business logic without taking care of server-side programming nor relational databases.
public interface TuyaClient {
@GET("/v1.0/devices/{device_id}")
Device getById(@Path("device_id") String deviceId);
}
Device.java:
@Data
@AllArgsConstructor
@NoArgsConstructor
@FieldDefaults(level = AccessLevel.PUBLIC)
public class Device {
String id;
@JSONField(name="update_time")
Long update_time;
@JSONField(name="create_time")
Long createTime;
Boolean online;
String icon;
// other fields here
}
我正在使用 tuya-spring-boot-starter 版本 1.3.0 来查询设备详细信息,如下所示:
TuyaClient.java:
Device.java:
问题:
某些字段(例如“update_time”)没有被 Fastjson 反序列化,没有明确的原因,从而产生以下错误:
_调用连接器时出错。 原因:com.alibaba.fastjson.JSONException:设置属性错误,mypackage.models.Device#updatetime"
我想知道为什么会发生这种情况,因为例如,与“update_time”具有相同类型的字段“create_time”正在被正确反序列化。
有什么线索吗?
Java version: 20 tuya-spring-boot-starter: 1.3.0