private KeyFetcher createKeyFetcher(
JDBCDataStore ds, Connection cx, PrimaryKey key, PrimaryKeyColumn col)
throws SQLException, IOException {
final Class t = col.getType();
if (col instanceof AutoGeneratedPrimaryKeyColumn) {
return new AutoGenerated(ds, key, col);
} else if (col instanceof SequencedPrimaryKeyColumn) {
return new FromSequence(ds, col);
} else {
if (Number.class.isAssignableFrom(t)) {
if (t == Short.class
|| t == Integer.class
|| t == Long.class
|| BigInteger.class.isAssignableFrom(t)
|| BigDecimal.class.isAssignableFrom(t)) {
return new FromPreviousIntegral(ds, cx, key, col);
}
} else if (CharSequence.class.isAssignableFrom(t)) {
return new FromRandom(ds, col);
}
}
throw new IOException("Cannot generate key value for column of type: " + t.getName());
}