Class ModelMap

All Implemented Interfaces:
Serializable, Cloneable, Iterable<ModelList>, Map<String,ModelList>, SequencedMap<String,ModelList>

class ModelMap extends LinkedHashMap<String,ModelList> implements 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:
  • Field Details

    • detail

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

    • 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 Details

    • getModels

      public ModelMap getModels() throws 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:
      Exception
    • lookup

      public Model lookup(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(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 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 Iterable<ModelList>
      Returns:
      this returns an iterator for existing model objects