View Javadoc

1   /*
2    * Copyright 2004-2006 the Seasar Foundation and the Others.
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, 
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.seasar.tuigwaa.database;
17  
18  import java.util.Map;
19  
20  public class DataRowImpl implements DataRow {
21  
22  	private final int rowIndex_;
23  
24  	private int columnIndex_ = -1;
25  
26  	private DataTable dataTable_;
27  
28  	public DataRowImpl(DataTable dataTable, int index) {
29  		this.dataTable_ = dataTable;
30  		this.rowIndex_ = index;
31  	}
32  
33  	public Object next() {
34  		Object data = dataTable_.getData(rowIndex_, ++columnIndex_);
35  		return data;
36  	}
37  
38  	public boolean hasNext() {
39  		return dataTable_.hasNextColumn(columnIndex_);
40  	}
41  
42  	public void remove() {
43  		// Do nothing
44  	}
45  
46  	public Object getCell() {
47  		return dataTable_.getData(rowIndex_, columnIndex_);
48  	}
49  
50  	public Object getCell(int columnIndex) {
51  		return dataTable_.getData(rowIndex_, columnIndex);
52  	}
53  	
54  	public Object getCell(String field){
55  		return dataTable_.getData(rowIndex_, field);
56  	}
57  	
58  	public Map getDataMap() {
59  		return dataTable_.getDataMap(rowIndex_);
60  	}
61  	
62  	public Object getDataObject(){
63  		return dataTable_.getRowObject(rowIndex_);
64  	}
65  	
66  	public String getHeader(){
67  		return dataTable_.getHeader(columnIndex_);
68  	}
69  	
70  }