Class NameRegister

java.lang.Object
org.jibx.schema.NameRegister

public class NameRegister extends Object
Holder for registration of all global components of a schema by name.
Author:
Dennis M. Sosnoski
  • Field Details

    • m_globalAttributeMap

      private HashMap m_globalAttributeMap
      Direct attribute definitions.
    • m_importedAttributeMap

      private HashMap m_importedAttributeMap
      External attribute definitions (lazy create, null if unused).
    • m_globalAttributeGroupMap

      private HashMap m_globalAttributeGroupMap
      Direct attribute group definitions.
    • m_importedAttributeGroupMap

      private HashMap m_importedAttributeGroupMap
      External attribute group definitions (lazy create, null if unused).
    • m_globalElementMap

      private HashMap m_globalElementMap
      Direct element definitions.
    • m_importedElementMap

      private HashMap m_importedElementMap
      External element definitions (lazy create, null if unused).
    • m_globalGroupMap

      private HashMap m_globalGroupMap
      Direct group definitions.
    • m_importedGroupMap

      private HashMap m_importedGroupMap
      External group definitions (lazy create, null if unused).
    • m_globalTypeMap

      private HashMap m_globalTypeMap
      Direct type definitions.
    • m_importedTypeMap

      private HashMap 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

      public AttributeElement registerAttribute(QName qname, AttributeElement def)
      Register global attribute in the current schema definition.
      Parameters:
      qname - name
      def - attribute definition
      Returns:
      prior registered definition (null if none)
    • registerAttributeGroup

      public AttributeGroupElement registerAttributeGroup(QName qname, AttributeGroupElement def)
      Register global attribute group in the current schema definition.
      Parameters:
      qname - name
      def - attribute definition
      Returns:
      prior registered definition (null if none)
    • registerElement

      public ElementElement registerElement(QName qname, ElementElement def)
      Register global element in the current schema definition.
      Parameters:
      qname - name
      def - element definition
      Returns:
      prior registered definition (null if none)
    • registerGroup

      public GroupElement registerGroup(QName qname, GroupElement def)
      Register global group in the current schema definition.
      Parameters:
      qname - name
      def - attribute definition
      Returns:
      prior registered definition (null if none)
    • registerType

      public CommonTypeDefinition registerType(QName qname, CommonTypeDefinition def)
      Register global type in the current schema definition.
      Parameters:
      qname - name
      def - attribute definition
      Returns:
      prior registered definition (null if none)
    • findInMaps

      private Object findInMaps(Object key, HashMap map1, HashMap map2)
      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 map
      map2 - backup map (null if none)
      Returns:
      value (null if value for key not in either map)
    • findAttribute

      public AttributeElement findAttribute(QName qname)
      Find global attribute by name.
      Parameters:
      qname - name
      Returns:
      definition, or null if not registered
    • findAttributeGroup

      public AttributeGroupElement findAttributeGroup(QName qname)
      Find attribute group by name.
      Parameters:
      qname - name
      Returns:
      definition, or null if not registered
    • findElement

      public ElementElement findElement(QName qname)
      Find global element by name.
      Parameters:
      qname - name
      Returns:
      definition, or null if not registered
    • findGroup

      public GroupElement findGroup(QName qname)
      Find group by name.
      Parameters:
      qname - name
      Returns:
      definition, or null if not registered
    • findType

      public CommonTypeDefinition findType(QName qname)
      Find global type by name.
      Parameters:
      qname - name
      Returns:
      definition, or null if not registered
    • mergeDefinitions

      public void mergeDefinitions(NameRegister mrg)
      Merge definitions directly into this register.
      Parameters:
      mrg - register supplying definitions to be merged
    • mergeMapNamespaced

      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.
      Parameters:
      uri - namespace URI to be used for keys from source map
      source -
      target -
    • mergeDefinitionsNamespaced

      public void mergeDefinitionsNamespaced(String uri, NameRegister mrg)
      Merge external definitions into this register.
      Parameters:
      uri - namespace URI to be used for merged external definitions
      mrg - register supplying external definitions
    • mergeLazyMap

      private HashMap mergeLazyMap(HashMap source, HashMap target)
      Merge one map into another, where the source map may be empty and the target map may be 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.
      Parameters:
      source -
      target - (null if none)
      Returns:
      target (possibly changed, if the supplied target was null)
    • mergeImportedDefinitions

      public void mergeImportedDefinitions(NameRegister mrg)
      Merge external definitions into this register.
      Parameters:
      mrg - register supplying external definitions