01: /*
02: * Created on Feb 26, 2005
03: */
04: package net.sourceforge.orbroker;
05:
06: import java.util.List;
07:
08: /**
09: * @author Nils Kilden-Pedersen
10: */
11: final class ImmutableSQL {
12: private final List parameterNames;
13: private final String sqlStatement;
14:
15: ImmutableSQL(String sqlStatement, List parameterNames) {
16: this .sqlStatement = sqlStatement;
17: this .parameterNames = parameterNames;
18: }
19:
20: String getSqlStatement() {
21: return this .sqlStatement;
22: }
23:
24: int getParameterCount() {
25: return this .parameterNames.size();
26: }
27:
28: String getParameterName(int index) {
29: return (String) this .parameterNames.get(index);
30: }
31:
32: boolean hasParameters() {
33: return !this .parameterNames.isEmpty();
34: }
35:
36: String[] copyParameterNames() {
37: return (String[]) this .parameterNames
38: .toArray(new String[this .parameterNames.size()]);
39: }
40:
41: /**
42: * @inheritDoc
43: * @see java.lang.Object#toString()
44: */
45: public String toString() {
46: return "SQL: " + getSqlStatement();
47: }
48: }
|