1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */ 
16  
17  
18  package org.apache.commons.beanutils;
19  
20  
21  import java.sql.ResultSetMetaData;
22  import java.sql.SQLException;
23  
24  
25  /**
26   * <p>Mock object that implements enough of
27   * <code>java.sql.ResultSetMetaData</code>
28   * to exercise the {@link ResultSetDyaClass} functionality.</p>
29   *
30   * @author Craig R. McClanahan
31   * @version $Revision: 1.4 $ $Date: 2004/02/28 13:18:36 $
32   */
33  
34  public class TestResultSetMetaData implements ResultSetMetaData {
35  
36  
37      // ----------------------------------------------------- Instance Variables
38  
39  
40      /**
41       * <p>Array of column names and class names for metadata.</p>
42       */
43      protected String metadata[][] = {
44          { "bigDecimalProperty", "java.math.BigDecimal" },
45          { "booleanProperty", Boolean.class.getName() },
46          { "byteProperty", Byte.class.getName() },
47          { "dateProperty", "java.sql.Date" },
48          { "doubleProperty", Double.class.getName() },
49          { "floatProperty", Float.class.getName() },
50          { "intProperty", Integer.class.getName() },
51          { "longProperty", Long.class.getName() },
52          { "nullProperty", "java.lang.String" },
53          { "shortProperty", Short.class.getName() },
54          { "stringProperty", "java.lang.String" },
55          { "timeProperty", "java.sql.Time" },
56          { "timestampProperty", "java.sql.Timestamp" },
57      };
58  
59  
60      // ---------------------------------------------------- Implemented Methods
61  
62  
63      public String getColumnClassName(int columnIndex) throws SQLException {
64          return (metadata[columnIndex - 1][1]);
65      }
66  
67  
68      public int getColumnCount() throws SQLException {
69          return (metadata.length);
70      }
71  
72      public String getColumnName(int columnIndex) throws SQLException {
73          return (metadata[columnIndex - 1][0]);
74      }
75  
76  
77      // -------------------------------------------------- Unimplemented Methods
78  
79  
80      public String getCatalogName(int columnIndex) throws SQLException {
81          throw new UnsupportedOperationException();
82      }
83  
84  
85      public int getColumnDisplaySize(int columnIndex) throws SQLException {
86          throw new UnsupportedOperationException();
87      }
88  
89  
90      public String getColumnLabel(int columnIndex) throws SQLException {
91          throw new UnsupportedOperationException();
92      }
93  
94  
95      public int getColumnType(int columnIndex) throws SQLException {
96          throw new UnsupportedOperationException();
97      }
98  
99  
100     public String getColumnTypeName(int columnIndex) throws SQLException {
101         throw new UnsupportedOperationException();
102     }
103 
104 
105     public int getPrecision(int columnIndex) throws SQLException {
106         throw new UnsupportedOperationException();
107     }
108 
109 
110     public int getScale(int columnIndex) throws SQLException {
111         throw new UnsupportedOperationException();
112     }
113 
114 
115     public String getSchemaName(int columnIndex) throws SQLException {
116         throw new UnsupportedOperationException();
117     }
118 
119 
120     public String getTableName(int columnIndex) throws SQLException {
121         throw new UnsupportedOperationException();
122     }
123 
124 
125     public boolean isAutoIncrement(int columnIndex) throws SQLException {
126         throw new UnsupportedOperationException();
127     }
128 
129 
130     public boolean isCaseSensitive(int columnIndex) throws SQLException {
131         throw new UnsupportedOperationException();
132     }
133 
134 
135     public boolean isCurrency(int columnIndex) throws SQLException {
136         throw new UnsupportedOperationException();
137     }
138 
139 
140     public boolean isDefinitelyWritable(int columnIndex) throws SQLException {
141         throw new UnsupportedOperationException();
142     }
143 
144 
145     public int isNullable(int columnIndex) throws SQLException {
146         throw new UnsupportedOperationException();
147     }
148 
149 
150     public boolean isReadOnly(int columnIndex) throws SQLException {
151         throw new UnsupportedOperationException();
152     }
153 
154 
155     public boolean isSearchable(int columnIndex) throws SQLException {
156         throw new UnsupportedOperationException();
157     }
158 
159 
160     public boolean isSigned(int columnIndex) throws SQLException {
161         throw new UnsupportedOperationException();
162     }
163 
164 
165     public boolean isWritable(int columnIndex) throws SQLException {
166         throw new UnsupportedOperationException();
167     }
168 
169 
170 }