/** * Add a type to the entry (the type doesn't have to be unique) */ public void addType(BaseBean bean, String type) { if (DDLogFlags.debug) { TraceLogger.put(TraceLogger.DEBUG, TraceLogger.SVC_DD, DDLogFlags.DBG_REG, 1, DDLogFlags.ADDTYPE, bean.name() + " " + type); } RegEntry se = this.getRegEntry(bean, true); se.add(type); }
/** * Remove a registry entry. */ public void removeEntry(String ID) { RegEntry entry = this.getRegEntry(ID); if (entry != null) entry.getBean().removePropertyChangeListener(this.changeTracer); this.removeRegEntry(entry); }
/** * 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; }
public void createBean(Node node, GraphManager mgr) throws Schema2BeansRuntimeException { if (this.isRoot) { mgr.completeRootBinding(this, node); } this.graphManager = mgr; try { mgr.fillProperties(this.beanProps(), node); } catch (Schema2BeansException e) { throw new Schema2BeansRuntimeException(e); } }
DDLocation getLocation() { return new DDParser.DDLocation(this.curParent, this.name, ((this.baseProp.isIndexed())? this.pos-1:-1), ((BeanProp)this.baseProp).getType()); }
/** * 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; }
protected void write(java.io.Writer out) throws java.io.IOException { XMLUtil.DOMWriter domWriter = getDOMWriter(); domWriter.setWriter(out); domWriter.write(document); }
/** * This is the normal top level method for taking a Java Bean and * dumping it as XML. * @param obj the java bean to write out * @param out the place to write it to * @param propertyName the top level property */ public static void writeBeanProperty(Object obj, Writer out, String propertyName) throws IOException, java.beans.IntrospectionException { BeanWriter beanOut = new XmlBeanWriter(out); writeBeanProperty(obj, beanOut, propertyName); }
/** * This method is similar to writeBeanProperty except that the * outer property name is not known and not printed. */ public static void writeBean(Object obj, Writer out) throws IOException, java.beans.IntrospectionException { BeanWriter beanOut = new XmlBeanWriter(out); writeBean(obj, beanOut); }
/** * Equivalent to isChoiceProperty(name) on the current bean property. */ public boolean isChoiceProperty() { return this.beanProp().isChoiceProperty(); }
/** * Return the list of all known attribute names for the current bean */ public String[] getAttributeNames() { BeanProp bp = this.beanProp(); if (bp != null) return bp.getAttributeNames(); else return null; }
/** * Build the current path up to the root node. See the BeanProp object * for more details. */ protected void buildPathName(StringBuffer str) { if (this.binding != null) { BeanProp p = this.binding.getBeanProp(this); if (p != null) p.buildPathName(this.binding, str); } }
/** * Return the BaseBean parent of the current bean. This might return null * either because this is the root of the graph or because this node is not * part of a schema2beans graph yet. */ public BaseBean parent() { BeanProp bp = this.beanProp(); if (bp != null) return this.beanProp().getBean(); else return null; }
public void addPropertyChangeListener(String n, PropertyChangeListener l) { BeanProp p = this.beanProp(n); if (p != null) p.addPCListener(l); }
public BaseProperty[] getChoiceProperties() { if (this.isChoiceProperty()) { return this.group.list(); } return null; }
/** * Return true of the specified schema2beans graph is registered with the * specified type. */ public boolean hasType(BaseBean bean, String type) { RegEntry r = this.getRegEntry(bean, false); if (r != null) return r.hasType(type); return false; }
/** * Remove an entry in the registry. */ public void removeEntry(BaseBean bean) { RegEntry entry = this.getRegEntry(bean, false); if (entry != null) { entry.getBean().removePropertyChangeListener(this.changeTracer); this.removeRegEntry(entry); } }