public SchemaType get_schema_type() { return schemaType(); }
public final boolean uses_invalidate_value() { SchemaType type = schemaType(); return type.isSimpleType() || type.getContentType() == SchemaType.SIMPLE_CONTENT; }
/** * Returns false if child elements are insensitive to order; * if it returns true, you're required to call invalidate_element_order * on children to the right of any child order rearrangement. */ public boolean is_child_element_order_sensitive() { if (!_isComplexType()) return false; return schemaType().isOrderSensitive(); }
public SchemaField get_attribute_field(QName attrName) { SchemaAttributeModel model = schemaType().getAttributeModel(); if (model == null) return null; return model.getAttribute(attrName); }
private final String getPrimitiveTypeName() { SchemaType type = schemaType(); if (type.isNoType()) return "unknown"; SchemaType t = type.getPrimitiveType(); if (t == null) return "complex"; else return t.getName().getLocalPart(); }
public SchemaType instanceType() { synchronized (monitor()) { return isNil() ? null : schemaType(); } }
public SchemaType get_element_type(QName eltName, QName xsiType) { return schemaType().getElementType( eltName, xsiType, get_store().get_schematypeloader() ); }
/** * A typestore user can return a visitor that is used to compute * default text and elementflags for an arbitrary element. */ public TypeStoreVisitor new_visitor() { if (!_isComplexContent()) return null; return new SchemaTypeVisitorImpl(schemaType().getContentModel()); }
/** * A typestore user can create a new TypeStoreUser instance for * a given attribute child, based on the attribute name. * * Returns null if there is no strongly typed information for that * given attributes. */ public TypeStoreUser create_attribute_user(QName attrName) { return (TypeStoreUser)((SchemaTypeImpl)schemaType()).createAttributeType(attrName, get_store().get_schematypeloader()); }
public SchemaType get_attribute_type(QName attrName) { return schemaType().getAttributeType( attrName, get_store().get_schematypeloader() ); }
private SchemaField schemaField() { SchemaType st = schemaType(); SchemaField field; // First check if this field has an anonymous type field = st.getContainerField(); if (field == null) field = get_store().get_schema_field(); return field; }
/** * Returns the default attribute text for the attribute with * the given name, or null if no default. */ public String get_default_attribute_text(QName attrName) { assert(_isComplexType()); if (!_isComplexType()) throw new IllegalStateException(); SchemaProperty prop = schemaType().getAttributeProperty(attrName); if (prop == null) return ""; return prop.getDefaultText(); }
/** * Called by code generated code to get the default attribute value * for a given attribute name, or null if none. */ protected XmlAnySimpleType get_default_attribute_value(QName name) { SchemaType sType = schemaType(); SchemaAttributeModel aModel = sType.getAttributeModel(); if (aModel == null) return null; SchemaLocalAttribute sAttr = aModel.getAttribute(name); if (sAttr == null) return null; return sAttr.getDefaultValue(); } }
/** * Returns the default element text, if it's consistent. If it's * not consistent, returns null, and requires a visitor walk. * * Also returns null if there is no default at all (although * that can also be discovered via get_elementflags without * doing a walk). */ public String get_default_element_text(QName eltName) { assert(_isComplexContent()); if (!_isComplexContent()) throw new IllegalStateException(); SchemaProperty prop = schemaType().getElementProperty(eltName); if (prop == null) return ""; return prop.getDefaultText(); }
/** * Returns the flags for the given attribute. */ public int get_attributeflags(QName attrName) { if (!_isComplexType()) return 0; SchemaProperty prop = schemaType().getAttributeProperty(attrName); if (prop == null) return 0; return (prop.hasDefault() == SchemaProperty.NEVER ? 0 : TypeStore.HASDEFAULT) | (prop.hasFixed() == SchemaProperty.NEVER ? 0 : TypeStore.FIXED); // BUGBUG: todo: hook up required? }
/** * Same as copy() but unsynchronized. * If Locale.COPY_USE_NEW_LOCALE is set in the options, a new locale will be created for the copy. * Warning: Using this method in mutithreaded environment can cause invalid states. */ public final XmlObject _copy(XmlOptions xmlOptions) { // immutable objects don't get copied. They're immutable if (isImmutable()) return this; check_orphaned(); SchemaTypeLoader stl = get_store().get_schematypeloader(); XmlObject result = (XmlObject)get_store().copy(stl, schemaType(), xmlOptions); return result; }
private TypeStoreUser setterHelper ( XmlObjectBase src ) { check_orphaned(); src.check_orphaned(); return get_store().copy_contents_from( src.get_store() ). get_store().change_type( src.schemaType() ); }
private TypeStoreUser objSetterHelper(XmlObjectBase srcObj, QName propName, int index, short kindSetterHelper) { XmlObjectBase target = getTargetForSetter(propName, index, kindSetterHelper); target.check_orphaned(); srcObj.check_orphaned(); return target.get_store().copy_contents_from( srcObj.get_store() ). get_store().change_type( srcObj.schemaType() ); }
/** * Returns the elementflags, if they're consistent. If they're * not, returns -1, and requires a vistor walk. */ public int get_elementflags(QName eltName) { if (!_isComplexContent()) return 0; SchemaProperty prop = schemaType().getElementProperty(eltName); if (prop == null) return 0; if (prop.hasDefault() == SchemaProperty.VARIABLE || prop.hasFixed() == SchemaProperty.VARIABLE || prop.hasNillable() == SchemaProperty.VARIABLE) return -1; return (prop.hasDefault() == SchemaProperty.NEVER ? 0 : TypeStore.HASDEFAULT) | (prop.hasFixed() == SchemaProperty.NEVER ? 0 : TypeStore.FIXED) | (prop.hasNillable() == SchemaProperty.NEVER ? 0 : TypeStore.NILLABLE); }
private XmlObject ensureStore() { if ((_flags & FLAG_STORE) != 0) return this; check_dated(); String value = (_flags & FLAG_NIL) != 0 ? "" : compute_text( has_store() ? get_store() : null ); XmlOptions options = new XmlOptions().setDocumentType(schemaType()); XmlObject x = XmlObject.Factory.newInstance( options ); XmlCursor c = x.newCursor(); c.toNextToken(); c.insertChars( value ); return x; }