Package io.inversion

Class Results<M extends java.util.Map<java.lang.String,​?>>

  • All Implemented Interfaces:
    java.lang.Iterable<M>

    public final class Results<M extends java.util.Map<java.lang.String,​?>>
    extends java.lang.Object
    implements java.lang.Iterable<M>
    Results are returned by a Db and transformed by Actions into Response content.

    Dbs are not responsible for mapping from column names to json names so a Results rows and terms will use column names until they are potentially transformed by an Action.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String debugQuery  
      protected int foundRows
      The total number of rows (if known) in the Db that match the query, not the number of rows returned in this Results.
      static java.lang.String LAST_QUERY  
      protected java.util.List<io.inversion.rql.Term> next
      The RQL terms that will get the next page of results the DB things there are more results.
      protected Query query
      the query that produced these results.
      protected java.util.List<M> rows
      The data the query produced.
      protected java.lang.String testQuery  
    • Constructor Summary

      Constructors 
      Constructor Description
      Results​(Query query)  
      Results​(Query query, int foundRows, java.util.List<M> rows)  
    • Field Detail

      • LAST_QUERY

        public static java.lang.String LAST_QUERY
      • next

        protected final java.util.List<io.inversion.rql.Term> next
        The RQL terms that will get the next page of results the DB things there are more results.

        Dbs are not responsible for mapping from column names to json names so these terms will have column names when initially returned from the Db.

        Actions should map the keys to the corresponding json name property names before returning to the caller.

      • query

        protected Query query
        the query that produced these results.
      • rows

        protected java.util.List<M extends java.util.Map<java.lang.String,​?>> rows
        The data the query produced.

        Dbs are not responsible for mapping from column names to json names so these maps will have column names keys when initially returned from the Db.

        Actions should map them to the corresponding json property names before returning to the caller.

      • foundRows

        protected int foundRows
        The total number of rows (if known) in the Db that match the query, not the number of rows returned in this Results.

        For paginated listings, foundRows generally be greater than rows.size()

      • debugQuery

        protected java.lang.String debugQuery
      • testQuery

        protected java.lang.String testQuery
    • Constructor Detail

      • Results

        public Results​(Query query)
      • Results

        public Results​(Query query,
                       int foundRows,
                       java.util.List<M> rows)
    • Method Detail

      • getQuery

        public Query getQuery()
      • iterator

        public java.util.Iterator<M> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<M extends java.util.Map<java.lang.String,​?>>
      • size

        public int size()
      • getRow

        public M getRow​(int index)
      • setRow

        public Results setRow​(int index,
                              M row)
      • getRows

        public java.util.List<M> getRows()
      • withRows

        public Results withRows​(java.util.List rows)
      • withRow

        public Results withRow​(M row)
      • getNext

        public java.util.List<io.inversion.rql.Term> getNext()
      • withNext

        public Results withNext​(io.inversion.rql.Term next)
      • withNext

        public Results withNext​(java.util.List<io.inversion.rql.Term> next)
      • getFoundRows

        public int getFoundRows()
      • withFoundRows

        public Results withFoundRows​(int foundRows)
      • getTestQuery

        public java.lang.String getTestQuery()
      • withTestQuery

        public Results withTestQuery​(java.lang.String testQuery)