Package org.jibx.schema
Class NameRegister
java.lang.Object
org.jibx.schema.NameRegister
Holder for registration of all global components of a schema by name.
- Author:
- Dennis M. Sosnoski
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate HashMap
Direct attribute group definitions.private HashMap
Direct attribute definitions.private HashMap
Direct element definitions.private HashMap
Direct group definitions.private HashMap
Direct type definitions.private HashMap
External attribute group definitions (lazy create,null
if unused).private HashMap
External attribute definitions (lazy create,null
if unused).private HashMap
External element definitions (lazy create,null
if unused).private HashMap
External group definitions (lazy create,null
if unused).private HashMap
External type definitions (lazy create,null
if unused). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindAttribute
(QName qname) Find global attribute by name.findAttributeGroup
(QName qname) Find attribute group by name.findElement
(QName qname) Find global element by name.Find group by name.private Object
findInMaps
(Object key, HashMap map1, HashMap map2) Find value in main or backup map.Find global type by name.void
Merge definitions directly into this register.void
mergeDefinitionsNamespaced
(String uri, NameRegister mrg) Merge external definitions into this register.void
Merge external definitions into this register.private HashMap
mergeLazyMap
(HashMap source, HashMap target) Merge one map into another, where the source map may be empty and the target map may benull
.private void
mergeMapNamespaced
(String uri, HashMap source, HashMap target) Merge one QName map into another, changing the namespace URI for keys in the source map.registerAttribute
(QName qname, AttributeElement def) Register global attribute in the current schema definition.registerAttributeGroup
(QName qname, AttributeGroupElement def) Register global attribute group in the current schema definition.registerElement
(QName qname, ElementElement def) Register global element in the current schema definition.registerGroup
(QName qname, GroupElement def) Register global group in the current schema definition.registerType
(QName qname, CommonTypeDefinition def) Register global type in the current schema definition.void
reset()
Reset register for reuse.
-
Field Details
-
m_globalAttributeMap
Direct attribute definitions. -
m_importedAttributeMap
External attribute definitions (lazy create,null
if unused). -
m_globalAttributeGroupMap
Direct attribute group definitions. -
m_importedAttributeGroupMap
External attribute group definitions (lazy create,null
if unused). -
m_globalElementMap
Direct element definitions. -
m_importedElementMap
External element definitions (lazy create,null
if unused). -
m_globalGroupMap
Direct group definitions. -
m_importedGroupMap
External group definitions (lazy create,null
if unused). -
m_globalTypeMap
Direct type definitions. -
m_importedTypeMap
External type definitions (lazy create,null
if unused).
-
-
Constructor Details
-
NameRegister
public NameRegister()Constructor.
-
-
Method Details
-
reset
public void reset()Reset register for reuse. -
registerAttribute
Register global attribute in the current schema definition.- Parameters:
qname
- namedef
- attribute definition- Returns:
- prior registered definition (
null
if none)
-
registerAttributeGroup
Register global attribute group in the current schema definition.- Parameters:
qname
- namedef
- attribute definition- Returns:
- prior registered definition (
null
if none)
-
registerElement
Register global element in the current schema definition.- Parameters:
qname
- namedef
- element definition- Returns:
- prior registered definition (
null
if none)
-
registerGroup
Register global group in the current schema definition.- Parameters:
qname
- namedef
- attribute definition- Returns:
- prior registered definition (
null
if none)
-
registerType
Register global type in the current schema definition.- Parameters:
qname
- namedef
- attribute definition- Returns:
- prior registered definition (
null
if none)
-
findInMaps
Find value in main or backup map. If the (non-null
) value is present in the main map it is returned directly; otherwise, if the backup map is non-null
it is checked.- Parameters:
key
-map1
- main mapmap2
- backup map (null
if none)- Returns:
- value (
null
if value for key not in either map)
-
findAttribute
Find global attribute by name.- Parameters:
qname
- name- Returns:
- definition, or
null
if not registered
-
findAttributeGroup
Find attribute group by name.- Parameters:
qname
- name- Returns:
- definition, or
null
if not registered
-
findElement
Find global element by name.- Parameters:
qname
- name- Returns:
- definition, or
null
if not registered
-
findGroup
Find group by name.- Parameters:
qname
- name- Returns:
- definition, or
null
if not registered
-
findType
Find global type by name.- Parameters:
qname
- name- Returns:
- definition, or
null
if not registered
-
mergeDefinitions
Merge definitions directly into this register.- Parameters:
mrg
- register supplying definitions to be merged
-
mergeMapNamespaced
Merge one QName map into another, changing the namespace URI for keys in the source map.- Parameters:
uri
- namespace URI to be used for keys from source mapsource
-target
-
-
mergeDefinitionsNamespaced
Merge external definitions into this register.- Parameters:
uri
- namespace URI to be used for merged external definitionsmrg
- register supplying external definitions
-
mergeLazyMap
Merge one map into another, where the source map may be empty and the target map may benull
. If the source map is nonempty but the target isnull
, 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.- Parameters:
source
-target
- (null
if none)- Returns:
- target (possibly changed, if the supplied target was
null
)
-
mergeImportedDefinitions
Merge external definitions into this register.- Parameters:
mrg
- register supplying external definitions
-