public final XmlLocale getXmlLocale ( ) { return get_store().get_locale(); }
/** * Called after every set operation to invalidate * the attached raw text. Also, if we were dated, * we make a note that we're now current, since the * latest set beats the previous invalidate. Also, * if we were nil, we're no longer. */ private final void set_commit() { boolean wasNilled = ((_flags & FLAG_NIL) != 0); _flags &= ~(FLAG_NIL | FLAG_ISDEFAULT); if ((_flags & FLAG_STORE) != 0) { _flags &= ~(FLAGS_DATED); get_store().invalidate_text(); if (wasNilled) get_store().invalidate_nil(); } else { _textsource = null; } }
public final Object monitor() { if (has_store()) return get_store().get_locale(); return this; }
/** * Called by a TypeStore to pull out the most reasonable * text value from us. This is done after we have invalidated * the store (typically when our value has been set). */ public final String build_text(NamespaceManager nsm) { assert((_flags & FLAG_STORE) != 0); assert((_flags & FLAG_VALUE_DATED) == 0); if ((_flags & (FLAG_NIL | FLAG_ISDEFAULT)) != 0) return ""; return compute_text( nsm == null ? has_store() ? get_store() : null : nsm); }
public XmlObject substitute(QName name, SchemaType type) { if (name == null) throw new IllegalArgumentException( "Invalid name (null)" ); if (type == null) throw new IllegalArgumentException( "Invalid type (null)" ); if ((_flags & FLAG_STORE) == 0) { throw new IllegalStateException( "XML Value Objects cannot be used with substitution" ); } synchronized (monitor()) { check_orphaned(); return (XmlObject) get_store().substitute( name, type ); } }
public XmlObject changeType(SchemaType type) { if (type == null) throw new IllegalArgumentException( "Invalid type (null)" ); if ((_flags & FLAG_STORE) == 0) { throw new IllegalStateException( "XML Value Objects cannot have thier type changed" ); } synchronized (monitor()) { check_orphaned(); return (XmlObject) get_store().change_type( type ); } }
/** * Called before every set and get, to ensure that we have * a correct picture of whether we're nillable, fixed, or * if we have a default that can be applied. */ private final void check_element_dated() { if ((_flags & FLAG_ELEMENT_DATED) != 0 && (_flags & FLAG_NOT_VARIABLE) == 0) { if ((_flags & FLAG_ORPHANED) != 0) throw new XmlValueDisconnectedException(); int eltflags = get_store().compute_flags(); // int eltflags = 0; _flags &= ~(FLAGS_ELEMENT | FLAG_ELEMENT_DATED); _flags |= eltflags; } if ((_flags & FLAG_NOT_VARIABLE) != 0) _flags &= ~(FLAG_ELEMENT_DATED); }
/** * 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; }
public SchemaType get_element_type(QName eltName, QName xsiType) { return schemaType().getElementType( eltName, xsiType, get_store().get_schematypeloader() ); }
private boolean preCheck() { // if ( isImmutable() ) // return true; if ( has_store() ) return get_store().get_locale().noSync(); return false; }
/** * 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; }
/** * Grabs the undelying litral representation, applying the * implementation's wscanon rule. * Null if not simple content. */ public final String get_wscanon_text() { if ((_flags & FLAG_STORE) == 0) { return apply_wscanon((String)_textsource); } else return get_store().fetch_text(get_wscanon_rule()); }
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() ); }
public XmlCursor newCursor() { if ((_flags & FLAG_STORE) == 0) throw new IllegalStateException("XML Value Objects cannot create cursors"); check_orphaned(); // Note that new_cursor does not really need sync .... XmlLocale l = getXmlLocale(); if (l.noSync()) { l.enter(); try { return get_store().new_cursor(); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return get_store().new_cursor(); } finally { l.exit(); } } }
public String getStringValue() { if (isImmutable()) { if ((_flags & FLAG_NIL) != 0) return null; return compute_text(null); } // Since complex-content types don't have a "natural" string value, we // emit the deeply concatenated, tag-removed content of the tag. synchronized (monitor()) { if (_isComplexContent()) return get_store().fetch_text(TypeStore.WS_PRESERVE); check_dated(); if ((_flags & FLAG_NIL) != 0) return null; return compute_text(has_store() ? get_store() : null); } }
public XmlObject[] execQuery ( String queryExpr, XmlOptions options ) { synchronized (monitor()) { TypeStore typeStore = get_store(); if (typeStore == null) { throw new XmlRuntimeException( "Cannot do XQuery on XML Value Objects" ); } try { return _typedArray(typeStore.exec_query( queryExpr, options )); } catch (XmlException e) { throw new XmlRuntimeException( e ); } } }
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; }