1 package org.kuali.common.jdbc.suppliers; 2 3 import org.kuali.common.jdbc.reader.SqlReader; 4 import org.kuali.common.util.Assert; 5 6 public final class SqlLocationContext { 7 8 public static final int DEFAULT_MAX_COUNT = 50; 9 public static final int DEFAULT_MAX_SIZE = 50 * 1024; 10 11 public SqlLocationContext(String encoding, SqlReader reader) { 12 this(encoding, reader, DEFAULT_MAX_COUNT, DEFAULT_MAX_SIZE); 13 } 14 15 public SqlLocationContext(String encoding, SqlReader reader, int maxCount, int maxSize) { 16 Assert.noBlanks(encoding); 17 Assert.noNulls(reader); 18 Assert.isTrue(maxCount > 0, "max count must be a positive integer"); 19 Assert.isTrue(maxSize >= 0, "max size is negative"); 20 this.encoding = encoding; 21 this.reader = reader; 22 this.maxCount = maxCount; 23 this.maxSize = maxSize; 24 } 25 26 private final String encoding; 27 private final SqlReader reader; 28 private final int maxCount; 29 private final int maxSize; 30 31 public String getEncoding() { 32 return encoding; 33 } 34 35 public SqlReader getReader() { 36 return reader; 37 } 38 39 public int getMaxCount() { 40 return maxCount; 41 } 42 43 public int getMaxSize() { 44 return maxSize; 45 } 46 47 }