本文整理匯總了Java中org.apache.commons.collections4.MapUtils.getLong方法的典型用法代碼示例。如果您正苦於以下問題:Java MapUtils.getLong方法的具體用法?Java MapUtils.getLong怎麽用?Java MapUtils.getLong使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.commons.collections4.MapUtils
的用法示例。
在下文中一共展示了MapUtils.getLong方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parseCommand
import org.apache.commons.collections4.MapUtils; //導入方法依賴的package包/類
private InstanceCommandStats parseCommand(long instanceId, String command,
Map<String, Object> commandMap, boolean isCommand, int type) {
Long collectTime = MapUtils.getLong(commandMap, ConstUtils.COLLECT_TIME, null);
if (collectTime == null) {
return null;
}
Long count;
if (isCommand) {
count = MapUtils.getLong(commandMap, "cmdstat_" + command.toLowerCase(), null);
} else {
count = MapUtils.getLong(commandMap, command.toLowerCase(), null);
}
if (count == null) {
return null;
}
InstanceCommandStats stats = new InstanceCommandStats();
stats.setCommandCount(count);
stats.setCommandName(command);
stats.setCollectTime(collectTime);
stats.setCreateTime(DateUtil.getDateByFormat(String.valueOf(collectTime), "yyyyMMddHHmm"));
stats.setModifyTime(DateUtil.getDateByFormat(String.valueOf(collectTime), "yyyyMMddHHmm"));
stats.setInstanceId(instanceId);
return stats;
}
示例2: saveStandardStats
import org.apache.commons.collections4.MapUtils; //導入方法依賴的package包/類
@Override
public boolean saveStandardStats(Map<String, Object> infoMap, Map<String, Object> clusterInfoMap, String ip, int port, String dbType) {
Assert.isTrue(infoMap != null && infoMap.size() > 0);
Assert.isTrue(StringUtils.isNotBlank(ip));
Assert.isTrue(port > 0);
Assert.isTrue(infoMap.containsKey(ConstUtils.COLLECT_TIME), ConstUtils.COLLECT_TIME + " not in infoMap");
long collectTime = MapUtils.getLong(infoMap, ConstUtils.COLLECT_TIME);
StandardStats ss = new StandardStats();
ss.setCollectTime(collectTime);
ss.setIp(ip);
ss.setPort(port);
ss.setDbType(dbType);
if (infoMap.containsKey(RedisConstant.DIFF.getValue())) {
Map<String, Object> diffMap = (Map<String, Object>) infoMap.get(RedisConstant.DIFF.getValue());
ss.setDiffMap(diffMap);
infoMap.remove(RedisConstant.DIFF.getValue());
} else {
ss.setDiffMap(new HashMap<String, Object>(0));
}
ss.setInfoMap(infoMap);
ss.setClusterInfoMap(clusterInfoMap);
int mergeCount = instanceStatsDao.mergeStandardStats(ss);
return mergeCount > 0;
}