Coverage Summary for Class: Result (net.sf.persism)

Class Class, % Method, % Line, %
Result 100% (1/1) 100% (4/4) 100% (10/10)


1 package net.sf.persism; 2  3 /** 4  * Result of an insert, update or delete. Contains the rows affected returned by JDBC and the original copy of the data object. 5  */ 6 public final class Result<T> { 7  private final int rows; 8  private final T dataObject; 9  10  /** 11  * 12  * @param rows rows affected 13  * @param dataObject possibly changed object after an insert. Use for Records which are immutable. 14  */ 15  public Result(int rows, T dataObject) { 16  this.rows = rows; 17  this.dataObject = dataObject; 18  } 19  20  /** 21  * Return value from jdbc statement getUpdateCount after an insert. 22  * @return row count changed 23  */ 24  public int rows() { 25  return rows; 26  } 27  28  /** 29  * Instance of the possibly modified object after insert. 30  * @return dataObject of type T 31  */ 32  public T dataObject() { 33  return dataObject; 34  } 35  36  @Override 37  public String toString() { 38  final StringBuilder sb = new StringBuilder("Result{"); 39  sb.append("rows=").append(rows); 40  sb.append(", dataObject=").append(dataObject); 41  sb.append('}'); 42  return sb.toString(); 43  } 44 }