/** * A utility method that fails with an exception if * {@link Row#indexOf(String)} doesn't return any index. */ static final int indexOrFail(Row row, String fieldName) { int result = row.indexOf(fieldName); if (result < 0) throw new IllegalArgumentException("Field (" + fieldName + ") is not contained in Row " + row); return result; }
/** * A utility method that fails with an exception if * {@link Row#indexOf(String)} doesn't return any index. */ static final int indexOrFail(Row row, String fieldName) { int result = row.indexOf(fieldName); if (result < 0) throw new IllegalArgumentException("Field (" + fieldName + ") is not contained in Row " + row); return result; }
/** * A utility method that fails with an exception if * {@link Row#indexOf(Field)} doesn't return any index. */ static final int indexOrFail(Row row, Field<?> field) { int result = row.indexOf(field); if (result < 0) throw new IllegalArgumentException("Field (" + field + ") is not contained in Row " + row); return result; }
/** * A utility method that fails with an exception if * {@link Row#indexOf(Name)} doesn't return any index. */ static final int indexOrFail(Row row, Name fieldName) { int result = row.indexOf(fieldName); if (result < 0) throw new IllegalArgumentException("Field (" + fieldName + ") is not contained in Row " + row); return result; }
/** * A utility method that fails with an exception if * {@link Row#indexOf(Field)} doesn't return any index. */ static final int indexOrFail(Row row, Field<?> field) { int result = row.indexOf(field); if (result < 0) throw new IllegalArgumentException("Field (" + field + ") is not contained in Row " + row); return result; }
static <T> T maybeGet(Record record, TableField<Record, T> field, T defaultValue) { if (record.fieldsRow().indexOf(field) < 0) { return defaultValue; } else { return record.get(field); } }
@Override public int findColumn(String columnLabel) throws SQLException { checkNotClosed(); Field<?> field = result.field(columnLabel); if (field == null) throw new SQLException("No such column : " + columnLabel); return result.fieldsRow().indexOf(field) + 1; }
@Override public int findColumn(String columnLabel) throws SQLException { checkNotClosed(); Field<?> field = result.field(columnLabel); if (field == null) { throw new SQLException("No such column : " + columnLabel); } return result.fieldsRow().indexOf(field) + 1; }