path = (new PathResolver(this.parent, path)).toString(); BaseBean root = this.parent.getRoot();
void resolveGraph(String path) { String pathRoot = null; if (PathResolver.needResolving(path)) path = (new PathResolver(this.parent, path)).toString(); int idx = path.indexOf(':'); if (idx != -1) { pathRoot = path.substring(idx+1); path = path.substring(0, idx); } BaseBean[] beans = this.registry.getRoots(path); if (beans.length > 0) { this.root = beans[0]; if (pathRoot != null) { DDCursor cur = new DDRegistryParser.DDCursor(this, pathRoot); this.root = cur.getRoot(); } } }
this.parser = new ParserSet(cursor.getRoot(), cur, parsingPath); } else { throw new IllegalStateException( Common.getMessage(
private boolean newParser() { if (this.cur < this.roots.length) { try { this.curParser = new DDParser(this.roots[this.cur++], this.parsingPath); return true; } catch(NoSuchElementException e) { // If the element is not found, try with our parent root, // this might be a linked graph. if(this.parentCursor != null) { this.cur = 0; this.roots = new BaseBean[] {this.parentCursor.getRoot()}; this.parentCursor = this.parentCursor.getParent(); return this.newParser(); } else throw e; } } return false; }
/** * Return the unique ID of the graph where the cursor points to. * Note that a DDCursor is a location reference (pointer to any * schema2beans graph) in any graph of the registry. */ public String getID(DDRegistryParser.DDCursor c) { RegEntry r = this.getRegEntry(c.getRoot(), false); if (r != null) return r.getID(); return null; }
/** * Same as getID but return the non unique name. */ public String getName(DDRegistryParser.DDCursor c) { RegEntry r = this.getRegEntry(c.getRoot(), false); if (r != null) return r.getName(); return null; }
private Object getDDNameValue(DDCursor pc, String path) { Object val = null; // Look for the value in the DDCursors and current graph // hierarchy (look first in the graph then in other DDCursors) do { val = this.getValue(pc.getRoot(), path); if (val == null) { pc = pc.getParent(); } } while(val == null && pc != null); return val; }