use of com.dexels.navajo.mapping.compiler.meta.ValueDefinition in project navajo by Dexels.
the class GenerateXSD method generateSetters.
private void generateSetters(XMLElement type, XMLElement choice, String adapterName, boolean addAsAttribute) throws Exception {
// Generate setters.
Iterator<String> setters = MapMetaData.getInstance().getMapDefinition(adapterName).getValueDefinitions().iterator();
while (setters.hasNext()) {
CaseSensitiveXMLElement x = new CaseSensitiveXMLElement("xs:element");
ValueDefinition vd = MapMetaData.getInstance().getMapDefinition(adapterName).getValueDefinition(setters.next());
x.setAttribute("type", (vd.getDirection().equals("out") ? "MapType" : "SetterType"));
x.setAttribute("name", adapterName + "." + vd.getName());
choice.addChild(x);
if (addAsAttribute) {
CaseSensitiveXMLElement xa = new CaseSensitiveXMLElement("xs:attribute");
xa.setAttribute("name", vd.getName());
xa.setAttribute("type", "xs:string");
if (vd.getRequired().equals("true")) {
xa.setAttribute("use", "required");
}
type.addChild(xa);
}
}
}
Aggregations