Skip to content

Commit

Permalink
feat: 增加对Jsonable的支持
Browse files Browse the repository at this point in the history
  • Loading branch information
zhou-hao committed Nov 14, 2023
1 parent e6f32d6 commit 0bdb880
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/org/jetlinks/core/utils/SerializeUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.hswebframework.web.dict.EnumDict;
import org.jetlinks.core.message.Message;
import org.jetlinks.core.message.MessageType;
import org.jetlinks.core.metadata.Jsonable;
import org.joda.time.DateTime;
import org.joda.time.LocalDate;
import org.joda.time.LocalDateTime;
Expand Down Expand Up @@ -76,6 +77,10 @@ public static Object convertToSafelySerializable(Object value) {
return value;
}

if(value instanceof Jsonable){
return ((Jsonable) value).toJson();
}

if (value instanceof Map) {
return Maps.transformValues(((Map<?, ?>) value), SerializeUtils::convertToSafelySerializable);
}
Expand Down

0 comments on commit 0bdb880

Please # to comment.