@Test public void testFromTypeDescriptor() throws Exception { }
public static FieldType fromTypeDescriptor(DataTypeDescriptor typeDescriptor) throws OperationException { int jdbcTypeId = typeDescriptor.getJDBCTypeId(); switch (jdbcTypeId) { case java.sql.Types.CHAR: case java.sql.Types.VARCHAR: case java.sql.Types.LONGNVARCHAR: case java.sql.Types.LONGVARCHAR: case java.sql.Types.NCHAR: case java.sql.Types.NVARCHAR: case java.sql.Types.CLOB: case java.sql.Types.NCLOB: return new StringField(DataTypeMapper.map(typeDescriptor), "" + typeDescriptor.getMaximumWidth()); case java.sql.Types.BLOB: case java.sql.Types.BINARY: case java.sql.Types.VARBINARY: case java.sql.Types.LONGVARBINARY: return new BinaryField(DataTypeMapper.map(typeDescriptor), "" + typeDescriptor.getMaximumWidth()); case java.sql.Types.SMALLINT: case java.sql.Types.TINYINT: case java.sql.Types.BIGINT: case java.sql.Types.DOUBLE: case java.sql.Types.INTEGER: case java.sql.Types.REAL: return new NumberField(DataTypeMapper.map(typeDescriptor)); case java.sql.Types.FLOAT: return new NumberField(DataTypeMapper.map(typeDescriptor), typeDescriptor.getPrecision()); case java.sql.Types.NUMERIC: case java.sql.Types.DECIMAL: return new NumberField(DataTypeMapper.map(typeDescriptor), typeDescriptor.getPrecision(), typeDescriptor.getScale()); case java.sql.Types.BIT: case java.sql.Types.BOOLEAN: return new BooleanField(); case java.sql.Types.DATE: return new DateField(); case java.sql.Types.TIME: return new TimeField(); case java.sql.Types.TIMESTAMP: return new TimestampField(); case java.sql.Types.REF: return new ReferenceField(); case java.sql.Types.ARRAY: case java.sql.Types.DATALINK: case java.sql.Types.DISTINCT: case java.sql.Types.JAVA_OBJECT: case java.sql.Types.NULL: case java.sql.Types.OTHER: case java.sql.Types.ROWID: case java.sql.Types.SQLXML: case java.sql.Types.STRUCT: default: throw new OperationException(ErrorCode.OPERATION_NOT_SUPPORTED, "The type " + typeDescriptor.getFullSQLTypeName() + " is not yet supported"); } }
FieldTypeFactory { public static FieldType fromTypeDescriptor(DataTypeDescriptor typeDescriptor) throws OperationException { int jdbcTypeId = typeDescriptor.getJDBCTypeId(); switch (jdbcTypeId) { case java.sql.Types.CHAR: case java.sql.Types.VARCHAR: case java.sql.Types.LONGNVARCHAR: case java.sql.Types.LONGVARCHAR: case java.sql.Types.NCHAR: case java.sql.Types.NVARCHAR: case java.sql.Types.CLOB: case java.sql.Types.NCLOB: return new StringField(DataTypeMapper.map(typeDescriptor), "" + typeDescriptor.getMaximumWidth()); case java.sql.Types.BLOB: case java.sql.Types.BINARY: case java.sql.Types.VARBINARY: case java.sql.Types.LONGVARBINARY: return new BinaryField(DataTypeMapper.map(typeDescriptor), "" + typeDescriptor.getMaximumWidth()); case java.sql.Types.SMALLINT: case java.sql.Types.TINYINT: case java.sql.Types.BIGINT: case java.sql.Types.DOUBLE: case java.sql.Types.INTEGER: case java.sql.Types.REAL: return new NumberField(DataTypeMapper.map(typeDescriptor)); case java.sql.Types.FLOAT: return new NumberField(DataTypeMapper.map(typeDescriptor), typeDescriptor.getPrecision()); case java.sql.Types.NUMERIC: case java.sql.Types.DECIMAL: return new NumberField(DataTypeMapper.map(typeDescriptor), typeDescriptor.getPrecision(), typeDescriptor.getScale()); case java.sql.Types.BIT: case java.sql.Types.BOOLEAN: return new BooleanField(); case java.sql.Types.DATE: return new DateField(); case java.sql.Types.TIME: return new TimeField(); case java.sql.Types.TIMESTAMP: return new TimestampField(); case java.sql.Types.REF: return new ReferenceField(); case java.sql.Types.ARRAY: case java.sql.Types.DATALINK: case java.sql.Types.DISTINCT: case java.sql.Types.JAVA_OBJECT: case java.sql.Types.NULL: case java.sql.Types.OTHER: case java.sql.Types.ROWID: case java.sql.Types.SQLXML: case java.sql.Types.STRUCT: default: throw new OperationException(ErrorCode.OPERATION_NOT_SUPPORTED, "The type " + typeDescriptor.getFullSQLTypeName() + " is not yet supported"); } } }
FieldTypeFactory { public static FieldType fromTypeDescriptor(DataTypeDescriptor typeDescriptor) throws OperationException { int jdbcTypeId = typeDescriptor.getJDBCTypeId(); switch (jdbcTypeId) { case java.sql.Types.CHAR: case java.sql.Types.VARCHAR: case java.sql.Types.LONGNVARCHAR: case java.sql.Types.LONGVARCHAR: case java.sql.Types.NCHAR: case java.sql.Types.NVARCHAR: case java.sql.Types.CLOB: case java.sql.Types.NCLOB: return new StringField(DataTypeMapper.map(typeDescriptor), "" + typeDescriptor.getMaximumWidth()); case java.sql.Types.BLOB: case java.sql.Types.BINARY: case java.sql.Types.VARBINARY: case java.sql.Types.LONGVARBINARY: return new BinaryField(DataTypeMapper.map(typeDescriptor), "" + typeDescriptor.getMaximumWidth()); case java.sql.Types.SMALLINT: case java.sql.Types.TINYINT: case java.sql.Types.BIGINT: case java.sql.Types.DOUBLE: case java.sql.Types.INTEGER: case java.sql.Types.REAL: return new NumberField(DataTypeMapper.map(typeDescriptor)); case java.sql.Types.FLOAT: return new NumberField(DataTypeMapper.map(typeDescriptor), typeDescriptor.getPrecision()); case java.sql.Types.NUMERIC: case java.sql.Types.DECIMAL: return new NumberField(DataTypeMapper.map(typeDescriptor), typeDescriptor.getPrecision(), typeDescriptor.getScale()); case java.sql.Types.BIT: case java.sql.Types.BOOLEAN: return new BooleanField(); case java.sql.Types.DATE: return new DateField(); case java.sql.Types.TIME: return new TimeField(); case java.sql.Types.TIMESTAMP: return new TimestampField(); case java.sql.Types.REF: return new ReferenceField(); case java.sql.Types.ARRAY: case java.sql.Types.DATALINK: case java.sql.Types.DISTINCT: case java.sql.Types.JAVA_OBJECT: case java.sql.Types.NULL: case java.sql.Types.OTHER: case java.sql.Types.ROWID: case java.sql.Types.SQLXML: case java.sql.Types.STRUCT: default: throw new OperationException(ErrorCode.OPERATION_NOT_SUPPORTED, "The type " + typeDescriptor.getFullSQLTypeName() + " is not yet supported"); } }  }
FieldTypeFactory { public static FieldType fromTypeDescriptor(DataTypeDescriptor typeDescriptor) throws OperationException { int jdbcTypeId = typeDescriptor.getJDBCTypeId(); switch (jdbcTypeId) { case java.sql.Types.CHAR: case java.sql.Types.VARCHAR: case java.sql.Types.LONGNVARCHAR: case java.sql.Types.LONGVARCHAR: case java.sql.Types.NCHAR: case java.sql.Types.NVARCHAR: case java.sql.Types.CLOB: case java.sql.Types.NCLOB: return new StringField(DataTypeMapper.map(typeDescriptor), "" + typeDescriptor.getMaximumWidth()); case java.sql.Types.BLOB: case java.sql.Types.BINARY: case java.sql.Types.VARBINARY: case java.sql.Types.LONGVARBINARY: return new BinaryField(DataTypeMapper.map(typeDescriptor), "" + typeDescriptor.getMaximumWidth()); case java.sql.Types.SMALLINT: case java.sql.Types.TINYINT: case java.sql.Types.BIGINT: case java.sql.Types.DOUBLE: case java.sql.Types.INTEGER: case java.sql.Types.REAL: return new NumberField(DataTypeMapper.map(typeDescriptor)); case java.sql.Types.FLOAT: return new NumberField(DataTypeMapper.map(typeDescriptor), typeDescriptor.getPrecision()); case java.sql.Types.NUMERIC: case java.sql.Types.DECIMAL: return new NumberField(DataTypeMapper.map(typeDescriptor), typeDescriptor.getPrecision(), typeDescriptor.getScale()); case java.sql.Types.BIT: case java.sql.Types.BOOLEAN: return new BooleanField(); case java.sql.Types.DATE: return new DateField(); case java.sql.Types.TIME: return new TimeField(); case java.sql.Types.TIMESTAMP: return new TimestampField(); case java.sql.Types.REF: return new ReferenceField(); case java.sql.Types.ARRAY: case java.sql.Types.DATALINK: case java.sql.Types.DISTINCT: case java.sql.Types.JAVA_OBJECT: case java.sql.Types.NULL: case java.sql.Types.OTHER: case java.sql.Types.ROWID: case java.sql.Types.SQLXML: case java.sql.Types.STRUCT: default: throw new OperationException(ErrorCode.OPERATION_NOT_SUPPORTED, "The type " + typeDescriptor.getFullSQLTypeName() + " is not yet supported"); } }  static FieldType fromJson(final JSONObject dataTypeJson); static FieldType fromTypeDescriptor(DataTypeDescriptor typeDescriptor); static FieldType fromString(String typeString); }
FieldTypeFactory { public static FieldType fromTypeDescriptor(DataTypeDescriptor typeDescriptor) throws OperationException { int jdbcTypeId = typeDescriptor.getJDBCTypeId(); switch (jdbcTypeId) { case java.sql.Types.CHAR: case java.sql.Types.VARCHAR: case java.sql.Types.LONGNVARCHAR: case java.sql.Types.LONGVARCHAR: case java.sql.Types.NCHAR: case java.sql.Types.NVARCHAR: case java.sql.Types.CLOB: case java.sql.Types.NCLOB: return new StringField(DataTypeMapper.map(typeDescriptor), "" + typeDescriptor.getMaximumWidth()); case java.sql.Types.BLOB: case java.sql.Types.BINARY: case java.sql.Types.VARBINARY: case java.sql.Types.LONGVARBINARY: return new BinaryField(DataTypeMapper.map(typeDescriptor), "" + typeDescriptor.getMaximumWidth()); case java.sql.Types.SMALLINT: case java.sql.Types.TINYINT: case java.sql.Types.BIGINT: case java.sql.Types.DOUBLE: case java.sql.Types.INTEGER: case java.sql.Types.REAL: return new NumberField(DataTypeMapper.map(typeDescriptor)); case java.sql.Types.FLOAT: return new NumberField(DataTypeMapper.map(typeDescriptor), typeDescriptor.getPrecision()); case java.sql.Types.NUMERIC: case java.sql.Types.DECIMAL: return new NumberField(DataTypeMapper.map(typeDescriptor), typeDescriptor.getPrecision(), typeDescriptor.getScale()); case java.sql.Types.BIT: case java.sql.Types.BOOLEAN: return new BooleanField(); case java.sql.Types.DATE: return new DateField(); case java.sql.Types.TIME: return new TimeField(); case java.sql.Types.TIMESTAMP: return new TimestampField(); case java.sql.Types.REF: return new ReferenceField(); case java.sql.Types.ARRAY: case java.sql.Types.DATALINK: case java.sql.Types.DISTINCT: case java.sql.Types.JAVA_OBJECT: case java.sql.Types.NULL: case java.sql.Types.OTHER: case java.sql.Types.ROWID: case java.sql.Types.SQLXML: case java.sql.Types.STRUCT: default: throw new OperationException(ErrorCode.OPERATION_NOT_SUPPORTED, "The type " + typeDescriptor.getFullSQLTypeName() + " is not yet supported"); } }  static FieldType fromJson(final JSONObject dataTypeJson); static FieldType fromTypeDescriptor(DataTypeDescriptor typeDescriptor); static FieldType fromString(String typeString);  }