public class NameRegister
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.HashMap |
m_globalAttributeGroupMap
Direct attribute group definitions.
|
private java.util.HashMap |
m_globalAttributeMap
Direct attribute definitions.
|
private java.util.HashMap |
m_globalElementMap
Direct element definitions.
|
private java.util.HashMap |
m_globalGroupMap
Direct group definitions.
|
private java.util.HashMap |
m_globalTypeMap
Direct type definitions.
|
private java.util.HashMap |
m_importedAttributeGroupMap
External attribute group definitions (lazy create,
null if unused). |
private java.util.HashMap |
m_importedAttributeMap
External attribute definitions (lazy create,
null if unused). |
private java.util.HashMap |
m_importedElementMap
External element definitions (lazy create,
null if unused). |
private java.util.HashMap |
m_importedGroupMap
External group definitions (lazy create,
null if unused). |
private java.util.HashMap |
m_importedTypeMap
External type definitions (lazy create,
null if unused). |
Constructor and Description |
---|
NameRegister()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
AttributeElement |
findAttribute(QName qname)
Find global attribute by name.
|
AttributeGroupElement |
findAttributeGroup(QName qname)
Find attribute group by name.
|
ElementElement |
findElement(QName qname)
Find global element by name.
|
GroupElement |
findGroup(QName qname)
Find group by name.
|
private java.lang.Object |
findInMaps(java.lang.Object key,
java.util.HashMap map1,
java.util.HashMap map2)
Find value in main or backup map.
|
CommonTypeDefinition |
findType(QName qname)
Find global type by name.
|
void |
mergeDefinitions(NameRegister mrg)
Merge definitions directly into this register.
|
void |
mergeDefinitionsNamespaced(java.lang.String uri,
NameRegister mrg)
Merge external definitions into this register.
|
void |
mergeImportedDefinitions(NameRegister mrg)
Merge external definitions into this register.
|
private java.util.HashMap |
mergeLazyMap(java.util.HashMap source,
java.util.HashMap target)
Merge one map into another, where the source map may be empty and the target map may be
null . |
private void |
mergeMapNamespaced(java.lang.String uri,
java.util.HashMap source,
java.util.HashMap target)
Merge one QName map into another, changing the namespace URI for keys in the source map.
|
AttributeElement |
registerAttribute(QName qname,
AttributeElement def)
Register global attribute in the current schema definition.
|
AttributeGroupElement |
registerAttributeGroup(QName qname,
AttributeGroupElement def)
Register global attribute group in the current schema definition.
|
ElementElement |
registerElement(QName qname,
ElementElement def)
Register global element in the current schema definition.
|
GroupElement |
registerGroup(QName qname,
GroupElement def)
Register global group in the current schema definition.
|
CommonTypeDefinition |
registerType(QName qname,
CommonTypeDefinition def)
Register global type in the current schema definition.
|
void |
reset()
Reset register for reuse.
|
private java.util.HashMap m_globalAttributeMap
private java.util.HashMap m_importedAttributeMap
null
if unused).private java.util.HashMap m_globalAttributeGroupMap
private java.util.HashMap m_importedAttributeGroupMap
null
if unused).private java.util.HashMap m_globalElementMap
private java.util.HashMap m_importedElementMap
null
if unused).private java.util.HashMap m_globalGroupMap
private java.util.HashMap m_importedGroupMap
null
if unused).private java.util.HashMap m_globalTypeMap
private java.util.HashMap m_importedTypeMap
null
if unused).public void reset()
public AttributeElement registerAttribute(QName qname, AttributeElement def)
qname
- namedef
- attribute definitionnull
if none)public AttributeGroupElement registerAttributeGroup(QName qname, AttributeGroupElement def)
qname
- namedef
- attribute definitionnull
if none)public ElementElement registerElement(QName qname, ElementElement def)
qname
- namedef
- element definitionnull
if none)public GroupElement registerGroup(QName qname, GroupElement def)
qname
- namedef
- attribute definitionnull
if none)public CommonTypeDefinition registerType(QName qname, CommonTypeDefinition def)
qname
- namedef
- attribute definitionnull
if none)private java.lang.Object findInMaps(java.lang.Object key, java.util.HashMap map1, java.util.HashMap map2)
null
) value is present in the main map it is
returned directly; otherwise, if the backup map is non-null
it is checked.key
- map1
- main mapmap2
- backup map (null
if none)null
if value for key not in either map)public AttributeElement findAttribute(QName qname)
qname
- namenull
if not registeredpublic AttributeGroupElement findAttributeGroup(QName qname)
qname
- namenull
if not registeredpublic ElementElement findElement(QName qname)
qname
- namenull
if not registeredpublic GroupElement findGroup(QName qname)
qname
- namenull
if not registeredpublic CommonTypeDefinition findType(QName qname)
qname
- namenull
if not registeredpublic void mergeDefinitions(NameRegister mrg)
mrg
- register supplying definitions to be mergedprivate void mergeMapNamespaced(java.lang.String uri, java.util.HashMap source, java.util.HashMap target)
uri
- namespace URI to be used for keys from source mapsource
- target
- public void mergeDefinitionsNamespaced(java.lang.String uri, NameRegister mrg)
uri
- namespace URI to be used for merged external definitionsmrg
- register supplying external definitionsprivate java.util.HashMap mergeLazyMap(java.util.HashMap source, java.util.HashMap target)
null
. If
the source map is nonempty but the target is null
, this creates a new map for the target and
returns that map; otherwise, the map returned is always the same as the target map passed in.source
- target
- (null
if none)null
)public void mergeImportedDefinitions(NameRegister mrg)
mrg
- register supplying external definitions