Search in sources :

Example 1 with ValueDefinition

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);
        }
    }
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) ValueDefinition(com.dexels.navajo.mapping.compiler.meta.ValueDefinition)

Aggregations

CaseSensitiveXMLElement (com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement)1 ValueDefinition (com.dexels.navajo.mapping.compiler.meta.ValueDefinition)1