/** * Called back by the DOMBinding when another bean removed the binding. * This allows an automatic update of all the bean trees sharing the * same DOM nodes. */ void removeBinding(DOMBinding binding) { throw new UnsupportedOperationException(Common. getMessage("NotImplementedYet_msg")); }
public void validate() { super.validate(); if (value == null || value.equals("")) throw new IllegalStateException(Common.getMessage("MSG_InvalidWhiteSpaceValue", value)); if (!(value == "preserve" || value == "replace" || value == "collapse")) throw new IllegalStateException(Common.getMessage("MSG_InvalidWhiteSpaceValue", value)); }
public void writeNoReindent(OutputStream out) throws IOException, Schema2BeansException { if (this.graphManager != null) { this.graphManager.write(out); } else throw new IllegalStateException(Common. getMessage("CantWriteBeanNotInDOMTree_msg")); }
public void reindent(String indent) { if (graphManager != null) { graphManager.reindent(indent); } else throw new IllegalStateException(Common. getMessage("CantWriteBeanNotInDOMTree_msg")); }
public void validate() { // Called at the end of the element parsing if (this.state != DONE) this.failed(Common.getMessage("BadAttributeDecl_msg")); }
public int getLevel() { Integer ret = (Integer)this.getValue(LEVEL); if (ret == null) throw new RuntimeException(Common.getMessage( "NoValueForElt_msg", new Object[] {"LEVEL", "int"})); return ((java.lang.Integer)ret).intValue(); }
public void checkEnum() { // Called when a | is found if (this.enumMode == 0) this.failed(Common.getMessage("UseCharORWithEnum_msg")); }
/** * Only works if the current thing in the stack is an Element. * @t should be a XML Schema type. */ public void setXMLSchemaType(String t) { ElementExpr e = peekCurrent(); if (e instanceof Element) ((Element)e).setXMLSchemaType(t); else throw new IllegalStateException(Common.getMessage("MSG_TryingToCallOnWrongClass", "setXMLSchemaType", e.getClass())); }
/** * Change the schema2beans graph for the unique entry ID. This method * might be used if another graph should replace an existing entry. */ public void updateEntry(String ID, BaseBean bean) { RegEntry entry = this.getRegEntry(ID); if (entry != null) entry.setBean(bean); else throw new IllegalArgumentException(Common.getMessage( "CantUpdateGraphNotInRegistry_msg", ID)); }
/** * Only works if the current thing in the stack is an Element. * @t should be a java type. */ public void setType(String t) { ElementExpr e = peekCurrent(); if (e instanceof Element) ((Element)e).setType(t); else throw new IllegalStateException(Common.getMessage("MSG_TryingToCallOnWrongClass", "setType", e.getClass())); }
/** * Create a new attribute on the current bean. */ public void createAttribute(String dtdName, String name, int type, String[] values, String defValue) { BeanProp bp = this.beanProp(); if (bp != null) bp.createAttribute(dtdName, name, type, values, defValue); else System.out.println(Common.getMessage("beanPropIsNull_msg", name)); }
/** * If the property is an indexed property, return all the values * as an array of its type. */ public Object[] getValues() { if (!Common.isArray(this.type)) throw new IllegalStateException(Common. getMessage("NotIndexedProperty_msg")); return this.getObjectArray(0); }
/** * Only works if the current thing in the stack is an Element or ModelGroup. */ public void setMaxOccurs(String t) { ElementExpr e = peekCurrent(); if (e instanceof Element) ((Element)e).setMaxOccurs(t); else if (e instanceof ModelGroup) ((ModelGroup)e).setMaxOccurs(t); else throw new IllegalStateException(Common.getMessage("MSG_TryingToCallOnWrongClass", "setMaxOccurs", e.getClass())); }
public int getSchemaTypeNum() { if ("xmlschema".equalsIgnoreCase(getSchemaType())) return XML_SCHEMA; if ("dtd".equalsIgnoreCase(getSchemaType())) return DTD; throw new IllegalStateException(Common.getMessage("MSG_IllegalSchemaName", getSchemaType())); }
public void validate() { //System.out.println("** validate: "+this); Map possibleSubElements = validSubElementTypeMap(); Iterator it = subElements.iterator(); while (it.hasNext()) { ElementExpr ee = (ElementExpr) it.next(); if (!possibleSubElements.containsKey(ee.getClass())) { throw new IllegalStateException(Common.getMessage("MSG_InvalidContents", toString(), ee.getName(), getFullContentName())); } ee.validate(); } }
public void readDocument(Document doc) { includedAlready.clear(); org.w3c.dom.Element childNode = doc.getDocumentElement(); if (childNode != null) { if (!childNode.getLocalName().equals("schema")) // NOI18N throw new IllegalStateException(Common.getMessage("MSG_ExpectedNode", "schema", childNode.getNodeName())); pushSchemaNode(); peekCurrentNeedSub().readSchema(childNode); readSchemaElement(childNode, false); popCurrent(); } }
public OutputStream getStream(String dir, String name, String extension) throws java.io.IOException { String filename = getFilename(dir, name, extension); if (!config.isQuiet()) config.messageOut.println(Common.getMessage("MSG_GeneratingClass", filename)); // NOI18N generatedFiles.add(filename); //return new FileOutputStream(filename); return new WriteIfDifferentOutputStream(filename); }
protected void close(OutputStream out) throws java.io.IOException { out.close(); if (!config.isQuiet() && config.isTraceGen() && out instanceof org.netbeans.modules.schema2beansdev.gen.WriteIfDifferentOutputStream) { org.netbeans.modules.schema2beansdev.gen.WriteIfDifferentOutputStream widos = (org.netbeans.modules.schema2beansdev.gen.WriteIfDifferentOutputStream) out; if (!widos.isChanged()) config.messageOut.println(Common.getMessage("MSG_DidNotChangeFile")); } }
/** * Only works if the current thing in the stack is an Element or ModelGroup. */ public void setMinOccurs(String t) { ElementExpr e = peekCurrent(); if (e instanceof Element) ((Element)e).setMinOccurs(t); else if (e instanceof ModelGroup) ((ModelGroup)e).setMinOccurs(t); else throw new IllegalStateException(Common.getMessage("MSG_TryingToCallOnWrongClass", "setMinOccurs", e.getClass())); }
private boolean checkVetoable(boolean raise) { if (Common.isVetoable(this.type) || Common.isBean(this.type)) return true; if (raise) { if (!Common.isBean(this.type)) { throw new Schema2BeansRuntimeException(Common. getMessage("PropertyDoesntSupportVeto_msg", this.beanName)); } } return false; }