java.sql.SQLData Java Examples
The following examples show how to use
java.sql.SQLData.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PreparedStatementIndexedSetterFactory.java From SimpleFlatMapper with MIT License | 5 votes |
@SuppressWarnings("unchecked") protected <T> ContextualIndexedSetter<PreparedStatement, T> getIndexedSetter(Type propertyType, PropertyMapping<?, ?, JdbcColumnKey> arg, ContextFactoryBuilder contextFactoryBuilder) { ContextualIndexedSetter<PreparedStatement, T> setter = null; if (TypeHelper.isEnum(propertyType)) { switch (arg.getColumnKey().getSqlType(arg.getColumnDefinition().properties())) { case Types.NUMERIC: case Types.BIGINT: case Types.INTEGER: case Types.DECIMAL: case Types.DOUBLE: case Types.FLOAT: case Types.SMALLINT: case Types.REAL: case Types.TINYINT: setter = (ContextualIndexedSetter<PreparedStatement, T>) new OrdinalEnumPreparedStatementIndexSetter(); break; default: setter = (ContextualIndexedSetter<PreparedStatement, T>) new StringEnumPreparedStatementIndexSetter(); } } if (setter == null) { Factory setterFactory = this.factoryPerClass.get(TypeHelper.toClass(propertyType)); if (setterFactory != null) { setter = setterFactory.<T>getIndexedSetter(arg.getColumnKey(), contextFactoryBuilder, arg.getColumnDefinition().properties()); } } if (setter == null && TypeHelper.isAssignable(SQLData.class, propertyType)) { setter = (ContextualIndexedSetter<PreparedStatement, T>) new ObjectPreparedStatementIndexSetter(); } return setter; }