MObjectInfo.java
1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package com.model;
import lombok.Data;
import org.apache.commons.lang.StringUtils;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* Created by yoho on 2016/6/14.
*/
@Data
public class MObjectInfo implements Serializable {
private int moId = 0;
private String moName;
private String moHostIp;
private int moTypeId;
//添加一个transient类型的字段,非数据字段
private String moTypeName;
private String moTags;
private String moUrl;
public Map<String, String> getMoTagsMap() {
Map<String, String> tagsMap = new HashMap<>();
if (StringUtils.isNotEmpty(moTags)) {
String[] tags = moTags.split(",");
if (null != tags && 0 < tags.length) {
for (String tagItem : tags) {
String[] kv = tagItem.split(":");
if (null != kv && 2 == kv.length && StringUtils.isNotBlank(kv[0]) && StringUtils.isNotBlank(kv[1])) {
tagsMap.put(kv[0], kv[1]);
}
}
}
}
return tagsMap;
}
}