1   package net.sourceforge.backpedal.impl.db;
2   
3   import net.sourceforge.backpedal.api.db.BindVariable;
4   import org.apache.commons.lang.builder.ToStringBuilder;
5   
6   import java.sql.PreparedStatement;
7   import java.sql.SQLException;
8   
9   public abstract class AbstractBindVariable implements BindVariable {
10      private int index;
11      private Object valueAsObject;
12      private String columnName;
13  
14      public AbstractBindVariable(int index, Object valueAsObject, String columnName) {
15          this.index = index;
16          this.valueAsObject = valueAsObject;
17          this.columnName = columnName;
18      }
19  
20      public int getIndex() {
21          return index;
22      }
23  
24      public Object getValue() {
25          return valueAsObject;
26      }
27  
28      public abstract int getSqlType();
29  
30      public void setIndex(int index) {
31          this.index = index;
32      }
33  
34      public void setValue(Object value) {
35          this.valueAsObject = value;
36      }
37  
38      public void setColumnName(String columnName) {
39          this.columnName = columnName;
40      }
41  
42      public Object clone() throws CloneNotSupportedException {
43          return super.clone();
44      }
45  
46      public boolean isNull() {
47          return false;
48      }
49  
50      public String getColumnName() {
51          return columnName;
52      }
53  
54      public String toString() {
55          return new ToStringBuilder(this).
56                  append("index",index).
57                  append("value",valueAsObject).toString();
58      }
59  
60      public void setInto(PreparedStatement preparedStatement) throws SQLException {
61          setInto(getIndex(),preparedStatement);
62      }
63  }
This page was automatically generated by Maven