Class Table<R>

  • All Implemented Interfaces:
    ITable<R>

    public abstract class Table<R>
    extends java.lang.Object
    implements ITable<R>
    The base class for all the generated table classes. The table content is read from a DOM element by means of the initFromXml(Element) method. This class provides methods that are used by the generated table classes to build up an in memory representation of the content so that clients of the generated table classes can effectively access the table content by means of the generated find methods.

    Generated table classes have a java.util.Map or a org.faktorips.util.ReadOnlyBinaryRangeTree member variable for each of their find methods. These maps or trees get filled at initialization time and are accessed within the find methods. Maps are used as member variables if the value to return can be identified by means of a hash key. A hash key can consist of multiple fields of value types (e.g. integer, long, decimal). If the value to return is identified by a range of key values a tree is used as the data structure to efficiently retrieve the value from. If the key that identifies a value consists of a combination of hash keys and range fields a map is used that contains trees as values. Depending on the number of range fields a tree hierarchy is build up where the depth of the hierarchy is determined by the number of range fields. That means that each node of a tree contains another tree representing the next level.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.List<R> rows
      Contains all rows of this table.
    • Constructor Summary

      Constructors 
      Constructor Description
      Table()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract void addRow​(java.util.List<java.lang.String> columns, IRuntimeRepository productRepository)
      Is used by the generated class to retrieve the values for a single row.
      java.util.List<R> getAllRows()
      Returns all rows of this table.
      java.lang.String getName()
      Returns the qualified name of this table.
      protected void init()  
      void initFromXml​(java.io.InputStream is, IRuntimeRepository productRepository, java.lang.String qualifiedTableName)
      Initializes this object with the data stored in the XML element.
      protected abstract void initKeyMaps()
      Is used by the generated classes to build up the the maps and trees that are used by the also generated find-methods.
      protected boolean isNull​(org.w3c.dom.Element valueElement)
      Is used by generated classes within the initKeyMaps() method to identify a null values.
      protected void performAdditionalInitializations()
      Template method to perform additional initializations.
      java.lang.String toString()
      Returns the String representation of up to ten of this table's rows.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • rows

        protected java.util.List<R> rows
        Contains all rows of this table.
    • Constructor Detail

      • Table

        public Table()
    • Method Detail

      • addRow

        protected abstract void addRow​(java.util.List<java.lang.String> columns,
                                       IRuntimeRepository productRepository)
        Is used by the generated class to retrieve the values for a single row.
        Parameters:
        columns - List of objects that contain the values.
      • initKeyMaps

        protected abstract void initKeyMaps()
        Is used by the generated classes to build up the the maps and trees that are used by the also generated find-methods.
      • initFromXml

        public void initFromXml​(java.io.InputStream is,
                                IRuntimeRepository productRepository,
                                java.lang.String qualifiedTableName)
                         throws java.lang.Exception
        Initializes this object with the data stored in the XML element.
        Throws:
        java.lang.Exception
      • init

        protected void init()
      • performAdditionalInitializations

        protected void performAdditionalInitializations()
        Template method to perform additional initializations. Is called during the initialization of the table (from XML), right after initKeyMaps().

        Subclasses may override to provide an implementation. The default implementation is empty, so no super-call is necessary.

      • isNull

        protected boolean isNull​(org.w3c.dom.Element valueElement)
        Is used by generated classes within the initKeyMaps() method to identify a null values.
        Parameters:
        valueElement - the element that contains the value for a field within a row
        Returns:
        true if the the isNull attribute contains true otherwise false
      • toString

        public java.lang.String toString()
        Returns the String representation of up to ten of this table's rows.
        Overrides:
        toString in class java.lang.Object
      • getName

        public java.lang.String getName()
        Description copied from interface: ITable
        Returns the qualified name of this table.
        Specified by:
        getName in interface ITable<R>
      • getAllRows

        public java.util.List<R> getAllRows()
        Description copied from interface: ITable
        Returns all rows of this table.
        Specified by:
        getAllRows in interface ITable<R>