MCPcopy Create free account
hub / github.com/MariaDB/server / GetFieldObject

Method GetFieldObject

storage/connect/Mongo2Interface.java:350–398  ·  view source on GitHub ↗
(String path)

Source from the content-addressed store, hash-verified

348 } // end of ColDescName
349
350 protected Object GetFieldObject(String path) {
351 Object o = null;
352 BasicDBObject dob = null;
353 BasicDBList lst = null;
354 String[] names = null;
355
356 if (path == null || path.equals("") || path.equals("*"))
357 return doc;
358 else if (doc instanceof BasicDBObject)
359 dob = doc;
360 // else if (o instanceof BasicDBList)
361 // lst = (BasicDBList) doc;
362 else
363 return doc;
364
365 try {
366 names = path.split("\\.");
367
368 for (String name : names) {
369 if (lst != null) {
370 o = lst.get(Integer.parseInt(name));
371 } else
372 o = dob.get(name);
373
374 if (o == null)
375 break;
376
377 if (DEBUG)
378 System.out.println("Class o = " + o.getClass());
379
380 if (o instanceof BasicDBObject) {
381 dob = (BasicDBObject) o;
382 lst = null;
383 } else if (o instanceof BasicDBList) {
384 lst = (BasicDBList) o;
385 } else
386 break;
387
388 } // endfor name
389
390 } catch (IndexOutOfBoundsException x) {
391 o = null;
392 } catch (MongoException se) {
393 SetErrmsg(se);
394 o = null;
395 } // end try/catch
396
397 return o;
398 } // end of GetFieldObject
399
400 public String GetField(String path) {
401 Object o = GetFieldObject(path);

Callers 1

GetFieldMethod · 0.95

Calls 4

SetErrmsgMethod · 0.95
splitMethod · 0.80
equalsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected