1 21 package net.mlw.vlh.adapter.jdbc.util.setter; 22 23 import java.sql.PreparedStatement ; 24 import java.sql.SQLException ; 25 import java.text.ParseException ; 26 27 34 public class StringSetter extends AbstractSetter 35 { 36 39 public int set(PreparedStatement query, int index, Object value) throws SQLException , ParseException 40 { 41 if (value == null || value instanceof String ) 42 { 43 query.setString(index++, (String ) value); 44 return index; 45 } 46 else 47 { 48 throw new IllegalArgumentException ("Cannot convert object of class " + value.getClass().getName() + " to a string at position " 49 + index); 50 } 51 } 52 } | Popular Tags |