BaseBean getBean(BaseBean root, String name) { while (root != null && !root.isRoot()) { if (root.hasName(name)) return root; root = root.parent(); } return null; }
void adjustPathRoot() { if (this.parsingPath.startsWith("../")) { // NOI18N int i = this.parsingPath.lastIndexOf("../"); // NOI18N int n = i/3; do { for (int j=0; j<this.roots.length; j++) { if (this.roots[j].isRoot()) throw new Schema2BeansRuntimeException(Common.getMessage( "CantAccessBaseBeanNode_msg", this.parsingPath)); this.roots[j] = this.roots[j].parent(); } } while(n-- > 0); this.parsingPath = this.parsingPath.substring(i+3); } }
String getValue(BaseBean root, String name) { String val = null; if (root != null) { do { try { val = (String)root.getValue(name); break; } catch(Exception e) { // Unknown property name - ignore it } root = root.parent(); } while (root != null && !root.isRoot()); } return val; }
/** * Return the entry for the BaseBean, if any. */ RegEntry getRegEntry(BaseBean bean, boolean raise) { for (int i=0; i<this.scopes.size(); i++) { RegEntry se = (RegEntry)this.scopes.get(i); if (se.getBean() == bean) { return se; } } // Didn't find it - try to look for the root if ((bean != null) && !bean.isRoot()) { do { bean = bean.parent(); } while(bean != null && !bean.isRoot()); return this.getRegEntry(bean, raise); } if (raise) { throw new IllegalArgumentException(Common.getMessage( "BeanGraphEntryNotInRegistry_msg", bean.name())); } else return null; }