private StockRecordBean parseLine(String line) throws ParseException { if (this.logger.isDebugEnabled()) { this.logger.debug(String.format("Parse the record [%s].", line)); } StockRecordBean record = new StockRecordBean(); String field; for (ParserPositionEnum value : ParserPositionEnum.values()) { field = line.substring(value.getStartPosition(), value.getEndPosition()).trim().toUpperCase(); switch (value) { case AVERAGE_NEGOTIATION_PRICE: record.setAverageNegotiationPrice(this.addPointAndParseToDouble(field)); break; case BDI: record.setBdi(Long.parseLong(field)); break; case CLOSING_NEGOTIATION_PRICE: record.setClosingNegotiationPrice(this.addPointAndParseToDouble(field)); break; case DATE: record.setTradeDate(DATE_FORMAT.parse(field)); break; case HIGHEST_BUY_OFFER_PRICE: record.setHighestBuyOfferPrice(this.addPointAndParseToDouble(field)); break; case HIGHEST_NEGOTIATION_PRICE: record.setHighestNegotiationPrice(this.addPointAndParseToDouble(field)); break; case LOWEST_NEGOTIATION_PRICE: record.setLowestNegotiationPrice(this.addPointAndParseToDouble(field)); break; case LOWEST_SELL_OFFER_PRICE: record.setLowestSellOfferPrice(this.addPointAndParseToDouble(field)); break; case START_PRICE: record.setStartPrice(this.addPointAndParseToDouble(field)); break; case STOCK_NAME: record.setStockName(field); break; case TOTAL_BUSINESS: record.setTotalBusiness(Long.parseLong(field)); break; case TOTAL_NEGOTIATION: record.setTotalNegotiation(Long.parseLong(field)); break; case TOTAL_VOLUME: record.setTotalVolume(this.addPointAndParseToDouble(field)); break; } } return record; }