org.apache.xmlbeans.impl.values

## Interface TypeStore

All Superinterfaces:
  NamespaceManager, PrefixResolver

    public interface TypeStore
    extends NamespaceManager

### Field Summary

Fields
`static int` `FIXED`
`static int` `HASDEFAULT`
`static int` `NILLABLE`
`static int` `WS_COLLAPSE`
`static int` `WS_PRESERVE`
`static int` `WS_REPLACE`
`static int` `WS_UNSPECIFIED`

### Method Summary

All Methods Instance Methods Abstract Methods Deprecated Methods
`TypeStoreUser` `add_attribute_user(QName name)` Adds an attribute with the given name and returns a TypeStoreUser underneath it.
`TypeStoreUser` `add_element_user(QName name)` Adds a new element at the last position adjacent to existing elements of the same name.
`void` `array_setter(XmlObject[] sources, QName elementName)` Copies the contents of the given array of XmlObject (including attributes, elements, mixed content), over all the elements of the given name under the current typestore.
`TypeStoreUser` `change_type(SchemaType sType)` Change the type of this store (perhaps by applying xsi:type) and return the new TypeStoreUser (or old one if the new type is not different).
`String` `compute_default_text()` Here the TypeStore is responsible for locating the default value.
`int` `compute_flags()` Here the TypeStore is responsible for figuring if this value is nillable and/or fixed.
`TypeStoreUser` `copy_contents_from(TypeStore source)` Copies the contents of the given TypeStore (including attributes, elements, and mixed content), to the target type store.
`TypeStoreUser` `copy(SchemaTypeLoader schemaTypeLoader, SchemaType schemaType, XmlOptions options)` Makes a copy of this store.
`int` `count_elements(QName name)` Returns the count of elements with the given name owned by this textstore.
`int` `count_elements(QNameSet names)` Returns the count of elements that match of the names.
`XmlObject[]` `exec_query(String queryExpr, XmlOptions options)`
`String` `fetch_text(int whitespaceRule)` A user of a TypeStore calls fetch_text when he knows his view of the text is invalid and he wants to see what the actual text value is.
`<T extends XmlObject> void` `find_all_element_users(QName name, List<T> fillMeUp)` Returns all the TypeStoreUsers corresponding to elements with the given name owned by this typestore, or the empty array of TypeStoreUsers if none was found.
`<T extends XmlObject> void` `find_all_element_users(QNameSet name, List<T> fillMeUp)` Returns all TypeStoreUsers corresponding to elements with one of the names is the QNameSet.
`TypeStoreUser` `find_attribute_user(QName name)` Returns the TypeStoreUser underneath the attribute with the given name, or null if there is no such attribute.
`TypeStoreUser` `find_element_user(QName name, int i)` Returns the TypeStoreUser underneath the ith element with the given name owned by this textstore, or null if none was found.
`TypeStoreUser` `find_element_user(QNameSet names, int i)` Like find_element_user but accepts a set of names to search for.
`boolean` `find_nil()` The TypeStore is reponsible for discovering if this value is nil.
`XmlLocale` `get_locale()` Returns the locale object which is used to manage thread safty and the gateway requirements for calls into the xml store
`Object` `get_root_object()` Deprecated.
`SchemaField` `get_schema_field()` Here the typestore is resposible for finding the schema field for this object.
`SchemaTypeLoader` `get_schematypeloader()` Get the SchemaTypeLoader associated with the store contianing this TypeStore.
`QName` `get_xsi_type()` Get the value of xsi:type.
`TypeStoreUser` `insert_element_user(QName name, int i)` Inserts a new element at the position that will make it the ith element with the given name owned by this textstore, and returns a TypeStoreUser for that element.
`TypeStoreUser` `insert_element_user(QNameSet set, QName name, int i)` Like the above method, except that it inserts an element named name, after the ith member of set.
`void` `invalidate_nil()` Called when the value has been nilled or unnilled, so the textstore knows it needs to update the xsi:nil attribute.
`void` `invalidate_text()` A user of a TypeStore calls invalidate_text when the underlying value has changed and he wants the textstore to call him back with a fetch_text (TypeStore/TypeStoreUsers work in pairs).
`boolean` `is_attribute()` Tells if this store is an attribute or not
`XmlCursor` `new_cursor()` Creates a new cursor positioned just before the part of the tree where this TypeStore is located.
`void` `remove_attribute(QName name)` Removes the attribute with the given name.
`void` `remove_element(QName name, int i)` Removes the ith element with the given name.
`void` `remove_element(QNameSet names, int i)` Removes the ith element that matches names.
`void` `store_text(String text)` A user of a TypeStore calls store_text when he wants the TypeStore to remember the given text immediately.
`TypeStoreUser` `substitute(QName name, SchemaType sType)`
`boolean` `validate_on_set()` Tells if this store was created with this option which tells the strongly typed objects to perform lexical and value validation after a setter is called.
`void` `validate(ValidatorListener vEventSink)`
`void` `visit_elements(TypeStoreVisitor visitor)` Visits all the elements immediately, using the given visitor.

### Methods inherited from interface org.apache.xmlbeans.impl.values.NamespaceManager

`find_prefix_for_nsuri`

### Methods inherited from interface org.apache.xmlbeans.impl.common.PrefixResolver

`getNamespaceForPrefix`

### Field Detail

#### WS_UNSPECIFIED

    static final int WS_UNSPECIFIED

See Also:
  Constant Field Values

#### WS_PRESERVE

    static final int WS_PRESERVE

See Also:
  Constant Field Values

#### WS_REPLACE

    static final int WS_REPLACE

See Also:
  Constant Field Values

#### WS_COLLAPSE

    static final int WS_COLLAPSE

See Also:
  Constant Field Values

#### NILLABLE

    static final int NILLABLE

See Also:
  Constant Field Values

#### HASDEFAULT

    static final int HASDEFAULT

See Also:
  Constant Field Values

#### FIXED

    static final int FIXED

See Also:
  Constant Field Values

### Method Detail

#### new_cursor

    XmlCursor new_cursor()

Creates a new cursor positioned just before the part of the tree where this TypeStore is located.

#### validate

    void validate(ValidatorListener vEventSink)

#### get_schematypeloader

    SchemaTypeLoader get_schematypeloader()

Get the SchemaTypeLoader associated with the store contianing this TypeStore.

#### change_type

    TypeStoreUser change_type(SchemaType sType)

Change the type of this store (perhaps by applying xsi:type) and return the new TypeStoreUser (or old one if the new type is not different).

#### substitute

    TypeStoreUser substitute(QName name,
                             SchemaType sType)

#### is_attribute

    boolean is_attribute()

Tells if this store is an attribute or not

#### get_xsi_type

    QName get_xsi_type()

Get the value of xsi:type. Return null if none or this is an attribute store.

#### invalidate_text

    void invalidate_text()

A user of a TypeStore calls invalidate_text when the underlying value has changed and he wants the textstore to call him back with a fetch_text (TypeStore/TypeStoreUsers work in pairs).

#### fetch_text

    String fetch_text(int whitespaceRule)

A user of a TypeStore calls fetch_text when he knows his view of the text is invalid and he wants to see what the actual text value is.

#### store_text

    void store_text(String text)

A user of a TypeStore calls store_text when he wants the TypeStore to remember the given text immediately. This typically happens when the user has a noncanonical (but valid) string representation to save, but doesn't have the storage in which to save it.

#### compute_default_text

    String compute_default_text()

Here the TypeStore is responsible for locating the default value. This is done as follows (1) go to the parent TypeStoreUser (2) ask it to get_default_element_text(qname) (or _attribute_), and return it if not null. (2) otherwise, grab a new TypeStoreUserVisitor via v = parentuser.new_visitor(); (3) call v.visit(name) on _every_ element qname up to and including this one in order (4) return the result of v.get_default_text().

#### compute_flags

    int compute_flags()

Here the TypeStore is responsible for figuring if this value is nillable and/or fixed. This is done by (1) go to the parent TypeStoreUser (2) ask it to get_elementflags(qname), and return it if not -1. (2) otherwise, grab a new TypeStoreUserVisitor via v = parentuser.new_visitor(); (3) call v.visit(name) on _every_ element qname up to and including this one in order (4) return the result of v.get_elementflags().

#### validate_on_set

    boolean validate_on_set()

Tells if this store was created with this option which tells the strongly typed objects to perform lexical and value validation after a setter is called.

#### get_schema_field

    SchemaField get_schema_field()

Here the typestore is resposible for finding the schema field for this object. This is done by (1) otherwise, grab a new TypeStoreUserVisitor via v = parentuser.new_visitor(); (2) call v.visit(name) on _every_ element qname up to and including this one in order (3) return the result of v.get_schema_field().

#### invalidate_nil

    void invalidate_nil()

Called when the value has been nilled or unnilled, so the textstore knows it needs to update the xsi:nil attribute.

#### find_nil

    boolean find_nil()

The TypeStore is reponsible for discovering if this value is nil. This is done by (1) going to the element and (2) finding the xsi:nil attribute if present and (3) return true if the collapsed textual value is either exactly the string "true" or "1".

#### count_elements

    int count_elements(QName name)

Returns the count of elements with the given name owned by this textstore.

#### count_elements

    int count_elements(QNameSet names)

Returns the count of elements that match of the names.

#### find_element_user

    TypeStoreUser find_element_user(QName name,
                                    int i)

Returns the TypeStoreUser underneath the ith element with the given name owned by this textstore, or null if none was found. Do not throw an IndexOutOfBoundsException if i is bad - return null instead. The reason is to allow us to fail and then follow with an add_element_etc if we choose to, without randomly catching exceptions.

#### find_element_user

    TypeStoreUser find_element_user(QNameSet names,
                                    int i)

Like find_element_user but accepts a set of names to search for.

#### find_all_element_users

    <T extends XmlObject> void find_all_element_users(QName name,
                                                      List<T> fillMeUp)

Returns all the TypeStoreUsers corresponding to elements with the given name owned by this typestore, or the empty array of TypeStoreUsers if none was found.

#### find_all_element_users

    <T extends XmlObject> void find_all_element_users(QNameSet name,
                                                      List<T> fillMeUp)

Returns all TypeStoreUsers corresponding to elements with one of the names is the QNameSet.

#### insert_element_user

    TypeStoreUser insert_element_user(QName name,
                                      int i)

Inserts a new element at the position that will make it the ith element with the given name owned by this textstore, and returns a TypeStoreUser for that element. Note that if there are no existing elements of the given name, you may need to call back to discover the proper ordering to use to insert the first one. Otherwise, it should be inserted adjacent to existing elements with the same name. Should throw an IndexOutOfBoundsException if i < 0 or if i > # of elts

#### insert_element_user

    TypeStoreUser insert_element_user(QNameSet set,
                                      QName name,
                                      int i)

Like the above method, except that it inserts an element named name, after the ith member of set.

#### add_element_user

    TypeStoreUser add_element_user(QName name)

Adds a new element at the last position adjacent to existing elements of the same name. Note that if there are no existing elements of the given name, the same comment applies as with insert_element_user.

#### remove_element

    void remove_element(QName name,
                        int i)

Removes the ith element with the given name. Should throw an IndexOutOfBoundsException if i < 0 or if i > # of elts-1.

#### remove_element

    void remove_element(QNameSet names,
                        int i)

Removes the ith element that matches names.

#### find_attribute_user

    TypeStoreUser find_attribute_user(QName name)

Returns the TypeStoreUser underneath the attribute with the given name, or null if there is no such attribute.

#### add_attribute_user

    TypeStoreUser add_attribute_user(QName name)

Adds an attribute with the given name and returns a TypeStoreUser underneath it. Should throw an IndexOutOfBoundsException if there is already an existing attribute with the given name.

#### remove_attribute

    void remove_attribute(QName name)

Removes the attribute with the given name.

#### copy_contents_from

    TypeStoreUser copy_contents_from(TypeStore source)

Copies the contents of the given TypeStore (including attributes, elements, and mixed content), to the target type store. SPECIAL NOTE: The xsi:type attribute should not be removed from the target or copied from the soruce, and the TypeStoreUser attached to this TypeStore should not be disconnected. This is for implementing obj.set(foo).

#### copy

    TypeStoreUser copy(SchemaTypeLoader schemaTypeLoader,
                       SchemaType schemaType,
                       XmlOptions options)

Makes a copy of this store. NOTE: Even if st is NO_TYPE, the store can be a document. This method will make an exact copy.

#### array_setter

    void array_setter(XmlObject[] sources,
                      QName elementName)

Copies the contents of the given array of XmlObject (including attributes, elements, mixed content), over all the elements of the given name under the current typestore. The lengths of the two arrays that are passed should be the same. If there are n current elements of the given name and m elements in the source array, there are several cases for individual elements: 1. If i < n and i < m, then the contents of the ith source are copied underneath the ith element; the ith element is not moved, but its TypeStoreUser is disconnected. 2. if i >= n and i < m, then first enough new elements are appended so that there is an element with the name i, then rule #1 is followed. 3. if i >= m and i < n, then the element #i and all its contents are removed.

#### visit_elements

    void visit_elements(TypeStoreVisitor visitor)

Visits all the elements immediately, using the given visitor. A TypeStoreUser calls this when somebody has requested validation.

#### exec_query

    XmlObject[] exec_query(String queryExpr,
                           XmlOptions options)

#### get_root_object

    Object get_root_object()

Deprecated.
Returns the monitor object, used for synchronizing access to the doc.

#### get_locale

    XmlLocale get_locale()

Returns the locale object which is used to manage thread safty and the gateway requirements for calls into the xml store