Class Imports<M extends IModel>

  • Type Parameters:
    M - the model type
    Direct Known Subclasses:
    Imports

    public class Imports<M extends IModel>
    extends java.lang.Object
    Stores the model imports for a language unit.
    Author:
    Holger Eichelberger
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<ModelImport<M>> imports  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      (package private) Imports()
      Constructor for serialization.
        Imports​(java.util.List<ModelImport<M>> imports)
      Creates an imports instance.
      protected Imports​(Imports<M> src)
      Creates an imports instance form the given src instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(ModelImport<M> imp)
      Adds an import.
      ModelImport<M> getImport​(int index)
      Get the parameter of this template at the specified index.
      ModelImport<M> getImport​(java.lang.String name)
      Returns an import matching the given name.
      int getImportsCount()
      Get the number of imports of this template.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Imports

        Imports()
        Constructor for serialization.
      • Imports

        public Imports​(java.util.List<ModelImport<M>> imports)
        Creates an imports instance.
        Parameters:
        imports - the actual imports
      • Imports

        protected Imports​(Imports<M> src)
        Creates an imports instance form the given src instance.
        Parameters:
        src - the source imports instance
    • Method Detail

      • getImportsCount

        public int getImportsCount()
        Get the number of imports of this template.
        Returns:
        The number of imports of this template.
      • getImport

        public ModelImport<M> getImport​(int index)
        Get the parameter of this template at the specified index.
        Parameters:
        index - The 0-based index of the import to be returned.
        Returns:
        The import at the given index.
        Throws:
        java.lang.IndexOutOfBoundsException - if index < 0 || index >=getImportsCount()
      • getImport

        public ModelImport<M> getImport​(java.lang.String name)
        Returns an import matching the given name.
        Parameters:
        name - the name to search for
        Returns:
        the matching import or null
      • add

        public void add​(ModelImport<M> imp)
        Adds an import.
        Parameters:
        imp - the import to be added