1 package com.softmotions.ejdb2; 2 3 /** 4 * SAM callback used iterate over query result set. 5 */ 6 public interface EJDB2DocumentCallback { 7 8 /** 9 * Called on every JSON record in result set. 10 * 11 * Implementor can control iteration behavior by returning a step getting next 12 * record: 13 * 14 * <ul> 15 * <li>{@code 1} go to the next record</li> 16 * <li>{@code N} move forward by {@code N} records</li> 17 * <li>{@code -1} iterate current record again</li> 18 * <li>{@code -2} go to the previous record</li> 19 * <li>{@code 0} stop iteration</li> 20 * </ul> 21 * 22 * @param id Current document identifier 23 * @param json Document {@link JSON} body as string 24 * @return Number of records to skip 25 */ onDocument(EJDB2Document doc)26 long onDocument(EJDB2Document doc); 27 } 28