Package org.dalesbred.result
Class ResultTable
java.lang.Object
org.dalesbred.result.ResultTable
- All Implemented Interfaces:
Iterable<ResultTable.ResultRow>
Represents the results of the query along with its metadata. Basically a detached
version of
ResultSet.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA builder for building ResultTables.static classProvides metadata about a column of the result.static classRepresents a single row of results. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull ResultTable.Builderbuilder(@NotNull List<ResultTable.ColumnMetadata> columns) Returns a builder for building a ResultTable for given columns.voidformatTo(@NotNull Appendable out) Pretty prints this table tooutin a format suitable for console.get(int row, int column) Returns the value of given column of given row.Returns the value of given named column of given row.int@NotNull List<ResultTable.ColumnMetadata> int@NotNull List<ResultTable.ResultRow> getRows()@NotNull Iterator<ResultTable.ResultRow> iterator()@NotNull StringtoString()@NotNull StringReturns a formatted representation of this table.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
getRowCount
public int getRowCount() -
getColumnCount
public int getColumnCount() -
get
Returns the value of given column of given row. Both indices are zero-based. -
get
Returns the value of given named column of given row. -
getRows
-
getColumns
-
getColumnNames
-
getColumnTypes
-
getRawColumnTypes
-
iterator
- Specified by:
iteratorin interfaceIterable<ResultTable.ResultRow>
-
toString
-
toStringFormatted
Returns a formatted representation of this table. SeeformatTo(Appendable)for details of the format.- See Also:
-
formatTo
Pretty prints this table tooutin a format suitable for console. Overly long columns are truncated and some effort is taken to make the result readable, but you should not depend on the exact details of the layout, since it might change.Hint: the output format is rouhgly that of Markdown tables, so you can use the result in your Markdown-documents. However, data is not escaped, since it's primarily meant to be written to console where escaping would hinder readability. Therefore, you might need to make manual adjustments to output if interpreting it as Markdown.
- Throws:
IOException- See Also:
-
builder
@NotNull public static @NotNull ResultTable.Builder builder(@NotNull @NotNull List<ResultTable.ColumnMetadata> columns) Returns a builder for building a ResultTable for given columns.
-