Skip to content

Commit 00f9391

Browse files
authored
refactor(common): 调整属性读写模式常量定义 (#712)
1 parent 70e42b1 commit 00f9391

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

jetlinks-components/common-component/src/main/java/org/jetlinks/community/PropertyMetadataConstants.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,38 +72,34 @@ static boolean isManual(PropertyMetadata metadata) {
7272
* 属性读写模式
7373
*/
7474
interface AccessMode {
75-
String id = "accessMode";
75+
String id = "type";
7676

7777
//读
78-
String read = "r";
78+
String read = "read";
7979
//写
80-
String write = "w";
80+
String write = "write";
8181
//上报
82-
String report = "u";
82+
String report = "report";
8383

8484
static boolean isRead(PropertyMetadata property) {
8585
return property
8686
.getExpand(id)
8787
.map(val -> val.toString().contains(read))
88-
.orElse(true);
88+
.orElse(false);
8989
}
9090

9191
static boolean isWrite(PropertyMetadata property) {
9292
return property
9393
.getExpand(id)
9494
.map(val -> val.toString().contains(write))
95-
.orElseGet(() -> property
96-
.getExpand("readOnly")
97-
.map(readOnly -> !CastUtils.castBoolean(readOnly))
98-
.orElse(true)
99-
);
95+
.orElse(false);
10096
}
10197

10298
static boolean isReport(PropertyMetadata property) {
10399
return property
104100
.getExpand(id)
105101
.map(val -> val.toString().contains(report))
106-
.orElse(true);
102+
.orElse(false);
107103
}
108104
}
109105

0 commit comments

Comments
 (0)