/** * Parses the given name and creates the corresponding QName. * <p> * If the given name is not prefixed then the default prefix (e.g. "") will be used (i.e. the name will remain * unprefixed). * * @param name the name in the prefixed form * @return the qname */ public static QName valueOf(String name) { return valueOf(name, ""); }
@Override public Field addField(String name, Type type, String defaultValue, int flags, Collection<Constraint> constraints) { QName qname = QName.valueOf(name, ns.prefix); FieldImpl field = new FieldImpl(qname, this, type, defaultValue, flags, constraints); addField(field); return field; }
public ListTypeImpl(String schema, String name, Type type, String fieldName, String defaultValue, int flags, Set<Constraint> constraints, int minOccurs, int maxOccurs) { super(null, schema, name); if (fieldName == null) { isArray = true; fieldName = "item"; } this.type = type; // if the list is an array, there's no field constraint (notnull) Collection<Constraint> computedConstraints = isArray ? type.getConstraints() : constraints; field = new FieldImpl(QName.valueOf(fieldName), this, type, defaultValue, flags, computedConstraints); this.minOccurs = minOccurs; this.maxOccurs = maxOccurs; this.defaultValue = defaultValue; }
field = fields.get(xpath); if (field == null) { QName qname = QName.valueOf(xpath); String prefix = qname.getPrefix(); Schema schema = getSchemaFromPrefix(prefix);
/** * Create a schema from a ComplexType * * @since 5.7 * @param complexType * @param name * @param ns */ public SchemaImpl(ComplexType complexType, String name, Namespace ns, boolean isVersionWritabe) { super(null, SchemaNames.SCHEMAS, name, ns); this.isVersionWritabe = isVersionWritabe; if (complexType != null) { for (Field field : complexType.getFields()) { QName fieldname = QName.valueOf(field.getName().getLocalName(), ns.prefix); Type type = field.getType(); String defaultValue = type.encode(field.getDefaultValue()); Set<Constraint> constraint = field.getConstraints(); FieldImpl newField = new FieldImpl(fieldname, this, type, defaultValue, 0, constraint); newField.setConstant(field.isConstant()); addField(newField); } } }