Class ModelMap

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<ModelList>, java.util.Map<java.lang.String,​ModelList>

    class ModelMap
    extends java.util.LinkedHashMap<java.lang.String,​ModelList>
    implements java.lang.Iterable<ModelList>
    The ModelMap object represents a map that contains string model mappings. This is used for convenience as a typedef like construct to avoid having declare the generic type whenever it is referenced. Also this allows ModelList values from the map to be iterated within for each loops.
    See Also:
    Model, ModelList
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Detail detail
      This is the detail associated with this model map instance.
    • Constructor Summary

      Constructors 
      Constructor Description
      ModelMap​(Detail detail)
      Constructor for the ModelMap object is used to create an empty map.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ModelMap getModels()
      This method is used to clone the model map such that mappings can be maintained in the original even if they are modified in the clone.
      java.util.Iterator<ModelList> iterator()
      This allows the ModelList objects within the model map to be iterated within for each loops.
      Model lookup​(java.lang.String name, int index)
      This method is used to look for a Model that matches the specified element name.
      void register​(java.lang.String name, Model model)
      This is used to register a Model within this map.
      • Methods inherited from class java.util.LinkedHashMap

        clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
      • Methods inherited from class java.util.HashMap

        clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
      • Methods inherited from class java.util.AbstractMap

        equals, hashCode, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
    • Field Detail

      • detail

        private final Detail detail
        This is the detail associated with this model map instance.
    • Constructor Detail

      • ModelMap

        public ModelMap​(Detail detail)
        Constructor for the ModelMap object is used to create an empty map. This is used for convenience as a typedef like construct which avoids having to use the generic type.
        Parameters:
        detail - this is the detail associated with the map
    • Method Detail

      • getModels

        public ModelMap getModels()
                           throws java.lang.Exception
        This method is used to clone the model map such that mappings can be maintained in the original even if they are modified in the clone. This is used to that the Schema can remove mappings from the model map as they are visited.
        Returns:
        this returns a cloned representation of this map
        Throws:
        java.lang.Exception
      • lookup

        public Model lookup​(java.lang.String name,
                            int index)
        This method is used to look for a Model that matches the specified element name. If no such model exists then this will return null. This is as a convenient way to find a model within the tree of models being built.
        Parameters:
        name - this is the name of the model to be acquired
        index - this is the index used to order the model
        Returns:
        this returns the model located by the expression
      • register

        public void register​(java.lang.String name,
                             Model model)
        This is used to register a Model within this map. Registration of a model creates a tree of models that can be used to represent an XML structure. Each model can contain elements and attributes associated with a type.
        Parameters:
        name - this is the name of the model to be registered
        model - this is the model that is to be registered
      • iterator

        public java.util.Iterator<ModelList> iterator()
        This allows the ModelList objects within the model map to be iterated within for each loops. This will provide all remaining model objects within the map. The iteration order is not maintained so model objects may be given in any sequence.
        Specified by:
        iterator in interface java.lang.Iterable<ModelList>
        Returns:
        this returns an iterator for existing model objects