Class TabularData

  • All Implemented Interfaces:
    java.lang.Cloneable, java.util.Map<java.lang.String,​java.lang.Object>, ISourceData

    @StableMinor(version="17.0",
                 sinceVersion="4.0")
    public class TabularData
    extends java.lang.Object
    implements ISourceData, java.lang.Cloneable
    Represents tabular data, through a set of ISourceData elements
    Since:
    4.0.0
    Version:
    $Revision: 26586 $ $Date: 2024-08-26 21:06:04 -0300 (Mon, 26 Aug 2024) $
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Constructor Summary

      Constructors 
      Constructor Description
      TabularData()
      Creates a new tabular data without any source association.
      TabularData​(Source source)
      Creates a new tabular data associated with the given source.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ISourceData addRow()
      Adds a row in this tabular data.
      void clear()
      Removes all rows in this tabular data.
      TabularData clone()  
      boolean containsKey​(java.lang.Object key)
      Delegates the call to the first row, or returns false if there is no first row.
      boolean containsValue​(java.lang.Object value)
      Delegates the call to the first row, or returns false if there is no first row.
      java.util.Set<java.util.Map.Entry<java.lang.String,​java.lang.Object>> entrySet()
      Delegates the call to the first row, or returns an empty set if there is no first row.
      java.lang.Object get​(java.lang.Object key)
      Delegates the call to the first row, or returns null if there is no first row.
      <T> T get​(java.lang.Object key, java.lang.Class<T> expectedClass)
      Delegates the call to the first row, or returns null if there is no first row.
      java.util.List<ISourceData> getRows()
      Returns the rows in this tabular data.
      int getTotalRows()  
      boolean isEmpty()
      Returns true if this tabular data has no row, false otherwise.
      java.util.Set<java.lang.String> keySet()
      Delegates the call to the first row, or returns an empty set if there is no first row.
      java.lang.Object put​(java.lang.String key, java.lang.Object value)
      Delegates the call to the first row.
      void putAll​(java.util.Map<? extends java.lang.String,​? extends java.lang.Object> t)
      Delegates the call to the first row.
      java.lang.Object remove​(java.lang.Object key)
      Delegates the call to the first row or returns null if there is no row.
      void setTotalRows​(int totalRows)  
      int size()
      Returns the number of rows in this tabular data.
      void sort​(java.util.Comparator<ISourceData> comparator)  
      java.lang.String toString()  
      java.util.Collection<java.lang.Object> values()
      Delegates the call to the first row, or returns an empty set if there is no first row.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
    • Constructor Detail

      • TabularData

        public TabularData()
        Creates a new tabular data without any source association.
        Since:
        4.0.4
      • TabularData

        public TabularData​(Source source)
        Creates a new tabular data associated with the given source.
        Parameters:
        source - the source.
        Since:
        4.0.4
    • Method Detail

      • getRows

        public java.util.List<ISourceData> getRows()
        Returns the rows in this tabular data. To add a row, use the method addRow() instead of calling directly the list add method.
        Returns:
        the rows in this tabular data.
        Since:
        4.0.4
      • addRow

        public ISourceData addRow()
        Adds a row in this tabular data.
        Returns:
        the added row.
        Since:
        4.0.4
      • getTotalRows

        public int getTotalRows()
      • setTotalRows

        public void setTotalRows​(int totalRows)
      • sort

        public void sort​(java.util.Comparator<ISourceData> comparator)
      • get

        public <T> T get​(java.lang.Object key,
                         java.lang.Class<T> expectedClass)
        Delegates the call to the first row, or returns null if there is no first row.
        Specified by:
        get in interface ISourceData
        Type Parameters:
        T - the expected class.
        Parameters:
        key - the data entry key.
        expectedClass - the expected class.
        Returns:
        the converted data value.
      • clear

        public void clear()
        Removes all rows in this tabular data.
        Specified by:
        clear in interface java.util.Map<java.lang.String,​java.lang.Object>
      • containsKey

        public boolean containsKey​(java.lang.Object key)
        Delegates the call to the first row, or returns false if there is no first row.
        Specified by:
        containsKey in interface java.util.Map<java.lang.String,​java.lang.Object>
      • containsValue

        public boolean containsValue​(java.lang.Object value)
        Delegates the call to the first row, or returns false if there is no first row.
        Specified by:
        containsValue in interface java.util.Map<java.lang.String,​java.lang.Object>
      • entrySet

        public java.util.Set<java.util.Map.Entry<java.lang.String,​java.lang.Object>> entrySet()
        Delegates the call to the first row, or returns an empty set if there is no first row.
        Specified by:
        entrySet in interface java.util.Map<java.lang.String,​java.lang.Object>
      • get

        public java.lang.Object get​(java.lang.Object key)
        Delegates the call to the first row, or returns null if there is no first row.
        Specified by:
        get in interface java.util.Map<java.lang.String,​java.lang.Object>
      • isEmpty

        public boolean isEmpty()
        Returns true if this tabular data has no row, false otherwise.
        Specified by:
        isEmpty in interface java.util.Map<java.lang.String,​java.lang.Object>
      • keySet

        public java.util.Set<java.lang.String> keySet()
        Delegates the call to the first row, or returns an empty set if there is no first row.
        Specified by:
        keySet in interface java.util.Map<java.lang.String,​java.lang.Object>
      • put

        public java.lang.Object put​(java.lang.String key,
                                    java.lang.Object value)
        Delegates the call to the first row. If there is no row one is created.
        Specified by:
        put in interface java.util.Map<java.lang.String,​java.lang.Object>
      • putAll

        public void putAll​(java.util.Map<? extends java.lang.String,​? extends java.lang.Object> t)
        Delegates the call to the first row. If there is no row one is created.
        Specified by:
        putAll in interface java.util.Map<java.lang.String,​java.lang.Object>
      • remove

        public java.lang.Object remove​(java.lang.Object key)
        Delegates the call to the first row or returns null if there is no row.
        Specified by:
        remove in interface java.util.Map<java.lang.String,​java.lang.Object>
      • size

        public int size()
        Returns the number of rows in this tabular data.
        Specified by:
        size in interface java.util.Map<java.lang.String,​java.lang.Object>
      • values

        public java.util.Collection<java.lang.Object> values()
        Delegates the call to the first row, or returns an empty set if there is no first row.
        Specified by:
        values in interface java.util.Map<java.lang.String,​java.lang.Object>
      • clone

        public TabularData clone()
        Overrides:
        clone in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object