@Test public void testEmptyString() { StringColumn column = new StringColumn(""); try { BigDecimal num = column.asBigDecimal(); } catch(Exception e) { Assert.assertTrue(e.getMessage().contains("String [\"\"] 不能转为BigDecimal")); } }
@Override public BigDecimal asBigDecimal() { if (null == this.getRawData()) { return null; } this.validateDoubleSpecific((String) this.getRawData()); try { return new BigDecimal(this.asString()); } catch (Exception e) { throw DataXException.asDataXException( CommonErrorCode.CONVERT_NOT_SUPPORT, String.format( "String [\"%s\"] 不能转为BigDecimal .", this.asString())); } }
StringColumn extends Column { @Override public BigDecimal asBigDecimal() { if (null == this.getRawData()) { return null; } this.validateDoubleSpecific((String) this.getRawData()); try { return new BigDecimal(this.asString()); } catch (Exception e) { throw DataXException.asDataXException( CommonErrorCode.CONVERT_NOT_SUPPORT, String.format( "String [\"%s\"] 不能转为BigDecimal .", this.asString())); } } }
StringColumn extends Column { @Override public BigDecimal asBigDecimal() { if (null == this.getRawData()) { return null; } this.validateDoubleSpecific((String) this.getRawData()); try { return new BigDecimal(this.asString()); } catch (Exception e) { throw DataXException.asDataXException( CommonErrorCode.CONVERT_NOT_SUPPORT, String.format( "String [\"%s\"] 不能转为BigDecimal .", this.asString())); } } StringColumn();  StringColumn(final String rawData); }
StringColumn extends Column { @Override public BigDecimal asBigDecimal() { if (null == this.getRawData()) { return null; } this.validateDoubleSpecific((String) this.getRawData()); try { return new BigDecimal(this.asString()); } catch (Exception e) { throw DataXException.asDataXException( CommonErrorCode.CONVERT_NOT_SUPPORT, String.format( "String [\"%s\"] 不能转为BigDecimal .", this.asString())); } } StringColumn();  StringColumn(final String rawData); @Override String asString(); @Override BigInteger asBigInteger(); @Override Long asLong(); @Override BigDecimal asBigDecimal(); @Override Double asDouble(); @Override Boolean asBoolean(); @Override Date asDate(); @Override byte[] asBytes(); }
StringColumn extends Column { @Override public BigDecimal asBigDecimal() { if (null == this.getRawData()) { return null; } this.validateDoubleSpecific((String) this.getRawData()); try { return new BigDecimal(this.asString()); } catch (Exception e) { throw DataXException.asDataXException( CommonErrorCode.CONVERT_NOT_SUPPORT, String.format( "String [\"%s\"] 不能转为BigDecimal .", this.asString())); } } StringColumn();  StringColumn(final String rawData); @Override String asString(); @Override BigInteger asBigInteger(); @Override Long asLong(); @Override BigDecimal asBigDecimal(); @Override Double asDouble(); @Override Boolean asBoolean(); @Override Date asDate(); @Override byte[] asBytes();  }