我需要使用一个接受哈希map
作为参数的 API。
但是,每当我在地图中插入键的值时,都需要打印日志。通过从外部 csv 文件中读取来分配键的值。
例如,
Map<String,String> myMap = new HashMap<String,String>();
myMap.put("nodeId", myMap.get("nodeIDForCreationOfTrackedAsset"));
myMap.put("templateAssetID", myMap.get("assetIdForServiceHistory"));
myMap.put("seqId", "{{db.WM_TS001.SeqNum}}");
myMap.put("badgeId", "{{db.WM_TS001.BadgeNum}}");
myMap.put("serialId","{{db.WM_TS001.SerialNum}}");
所以每次我使用 myMap.put(key,value) 时,它都应该将日志打印到外部文件,如下所示
element nodeId is assigned to "value" successfully.
element seqId is assigned to "value" successfully.
element templateAssetID is assigned to "value" successfully.
element badgeId is assigned to "value" successfully.
element serialId is assigned to "value" successfully.
myMap.put(key,value)
是否有任何通用方法可以做到这一点,以便在遇到时可以通过程序打印日志。