コード例 #1
0
ファイル: AnObjectImpl.java プロジェクト: leonjeru/sqlighter
 @Override
 public Map<String, Object> getJsonMap() throws Exception {
   if (jsonMap == null) {
     jsonMap = new HashMap<>();
     Set<String> p = attribMap.keySet();
     for (String attrName : p) {
       AnAttrib attr = attribMap.get(attrName);
       Object value = attr.getValue();
       if (value != null) {
         jsonMap.put(attr.getJsonOrAttribName(), attr.getValue());
       }
     }
   }
   if (parentAnObject != null) {
     @SuppressWarnings("unchecked")
     Map<String, Object> parentJsonMap = parentAnObject.getJsonMap();
     Set<String> keys = parentJsonMap.keySet();
     for (String k : keys) {
       jsonMap.put(k, parentJsonMap.get(k));
     }
   }
   return jsonMap;
 }
コード例 #2
0
ファイル: AnObjectImpl.java プロジェクト: leonjeru/sqlighter
 @Override
 public synchronized Map<String, Object> asMap(T nativeObject) throws Exception {
   setNativeObject(nativeObject);
   if (nativeObjectMap == null) {
     nativeObjectMap = new HashMap<>();
     Set<String> p = attribMap.keySet();
     for (String pName : p) {
       AnAttrib pm = attribMap.get(pName);
       Object value = pm.getValue();
       if (value != null) {
         nativeObjectMap.put(pName, pm.getValue());
       }
     }
   }
   if (parentAnObject != null) {
     @SuppressWarnings("unchecked")
     Map<String, Object> parentMap = parentAnObject.asMap(nativeObject);
     Set<String> keys = parentMap.keySet();
     for (String k : keys) {
       nativeObjectMap.put(k, parentMap.get(k));
     }
   }
   return nativeObjectMap;
 }