use of org.apache.cxf.javascript.AttributeInfo in project cxf by apache.
the class SchemaJavascriptBuilder method complexTypeConstructorAndAccessors.
// In general, I (bimargulies) hate fields that are temporary communications
// between members of a class. However, given the style restrictions on the
// number
// of parameters, it's the least of the evils.
public void complexTypeConstructorAndAccessors(QName name, XmlSchemaComplexType type) {
accessors = new StringBuilder();
utils = new JavascriptUtils(code);
List<XmlSchemaObject> items = JavascriptUtils.getContentElements(type, xmlSchemaCollection);
List<XmlSchemaAnnotated> attrs = XmlSchemaUtils.getContentAttributes(type, xmlSchemaCollection);
final String elementPrefix = "this._";
String typeObjectName = nameManager.getJavascriptName(name);
code.append("//\n");
code.append("// Constructor for XML Schema item " + name.toString() + "\n");
code.append("//\n");
code.append("function " + typeObjectName + " () {\n");
// to assist in debugging we put a type property into every object.
utils.appendLine("this.typeMarker = '" + typeObjectName + "';");
for (XmlSchemaObject thing : items) {
ParticleInfo itemInfo = ParticleInfo.forLocalItem(thing, xmlSchema, xmlSchemaCollection, prefixAccumulator, type.getQName());
constructItem(type, elementPrefix, typeObjectName, itemInfo);
}
for (XmlSchemaAnnotated thing : attrs) {
AttributeInfo itemInfo = AttributeInfo.forLocalItem(thing, xmlSchema, xmlSchemaCollection, prefixAccumulator, type.getQName());
constructOneItem(type, elementPrefix, typeObjectName, itemInfo);
}
code.append("}\n\n");
code.append(accessors.toString());
}
Aggregations