List of usage examples for java.sql ResultSetMetaData ResultSetMetaData
ResultSetMetaData
From source file:org.omnaest.utils.table.impl.adapter.TableToResultSetAdapter.java
@Override public ResultSetMetaData getMetaData() throws SQLException { return new ResultSetMetaData() { @Override/*from www . j a v a 2 s .c om*/ public <T> T unwrap(Class<T> iface) throws SQLException { throw new UnsupportedOperationException(); } @Override public boolean isWrapperFor(Class<?> iface) throws SQLException { throw new UnsupportedOperationException(); } @Override public boolean isWritable(int column) throws SQLException { return true; } @Override public boolean isSigned(int column) throws SQLException { throw new UnsupportedOperationException(); } @Override public boolean isSearchable(int column) throws SQLException { throw new UnsupportedOperationException(); } @Override public boolean isReadOnly(int column) throws SQLException { return false; } @Override public int isNullable(int column) throws SQLException { return ResultSetMetaData.columnNullable; } @Override public boolean isDefinitelyWritable(int column) throws SQLException { throw new UnsupportedOperationException(); } @Override public boolean isCurrency(int column) throws SQLException { throw new UnsupportedOperationException(); } @Override public boolean isCaseSensitive(int column) throws SQLException { return true; } @Override public boolean isAutoIncrement(int column) throws SQLException { return false; } @Override public String getTableName(int column) throws SQLException { Object tableName = TableToResultSetAdapter.this.table.getTableName(); return tableName != null ? String.valueOf(tableName) : null; } @Override public String getSchemaName(int column) throws SQLException { throw new UnsupportedOperationException(); } @Override public int getScale(int column) throws SQLException { throw new UnsupportedOperationException(); } @Override public int getPrecision(int column) throws SQLException { throw new UnsupportedOperationException(); } @Override public String getColumnTypeName(int column) throws SQLException { throw new UnsupportedOperationException(); } @Override public int getColumnType(int column) throws SQLException { throw new UnsupportedOperationException(); } @Override public String getColumnName(int column) throws SQLException { // String retval = null; // Object columnTitleValue = null; try { columnTitleValue = TableToResultSetAdapter.this.table.getColumnTitle(column - 1); retval = columnTitleValue != null ? String.valueOf(columnTitleValue) : null; } catch (Exception e) { } // return retval; } @Override public String getColumnLabel(int column) throws SQLException { return this.getColumnName(column); } @Override public int getColumnDisplaySize(int column) throws SQLException { return this.getColumnName(column).length(); } @Override public int getColumnCount() throws SQLException { return TableToResultSetAdapter.this.table.columnSize(); } @Override public String getColumnClassName(int column) throws SQLException { throw new UnsupportedOperationException(); } @Override public String getCatalogName(int column) throws SQLException { throw new UnsupportedOperationException(); } }; }