View Javadoc
1   /*
2   Copyright (c) 2013 James Ahlborn
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  package com.healthmarketscience.jackcess;
18  
19  import java.io.IOException;
20  import java.util.Date;
21  import java.util.Map;
22  import java.math.BigDecimal;
23  
24  import com.healthmarketscience.jackcess.complex.ComplexValueForeignKey;
25  import com.healthmarketscience.jackcess.util.OleBlob;
26  
27  
28  /**
29   * A row of data as column name->value pairs.  Values are strongly typed, and
30   * column names are case sensitive.
31   *
32   * @author James Ahlborn
33   * @usage _general_class_
34   */
35  public interface Row extends Map<String,Object>
36  {
37    /**
38     * @return the id of this row 
39     */
40    public RowId getId();
41  
42    /**
43     * Convenience method which gets the value for the row with the given name,
44     * casting it to a String (DataTypes TEXT, MEMO, GUID).
45     */
46    public String getString(String name);
47  
48    /**
49     * Convenience method which gets the value for the row with the given name,
50     * casting it to a Boolean (DataType BOOLEAN).
51     */
52    public Boolean getBoolean(String name);
53  
54    /**
55     * Convenience method which gets the value for the row with the given name,
56     * casting it to a Byte (DataType BYTE).
57     */
58    public Byte getByte(String name);
59  
60    /**
61     * Convenience method which gets the value for the row with the given name,
62     * casting it to a Short (DataType INT).
63     */
64    public Short getShort(String name);
65  
66    /**
67     * Convenience method which gets the value for the row with the given name,
68     * casting it to a Integer (DataType LONG).
69     */
70    public Integer getInt(String name);
71  
72    /**
73     * Convenience method which gets the value for the row with the given name,
74     * casting it to a BigDecimal (DataTypes MONEY, NUMERIC).
75     */
76    public BigDecimal getBigDecimal(String name);
77  
78    /**
79     * Convenience method which gets the value for the row with the given name,
80     * casting it to a Float (DataType FLOAT).
81     */
82    public Float getFloat(String name);
83  
84    /**
85     * Convenience method which gets the value for the row with the given name,
86     * casting it to a Double (DataType DOUBLE).
87     */
88    public Double getDouble(String name);
89  
90    /**
91     * Convenience method which gets the value for the row with the given name,
92     * casting it to a Date (DataType SHORT_DATE_TIME).
93     */
94    public Date getDate(String name);
95  
96    /**
97     * Convenience method which gets the value for the row with the given name,
98     * casting it to a byte[] (DataTypes BINARY, OLE).
99     */
100   public byte[] getBytes(String name);
101 
102   /**
103    * Convenience method which gets the value for the row with the given name,
104    * casting it to a {@link ComplexValueForeignKey} (DataType COMPLEX_TYPE).
105    */
106   public ComplexValueForeignKey getForeignKey(String name);
107 
108   /**
109    * Convenience method which gets the value for the row with the given name,
110    * converting it to an {@link OleBlob} (DataTypes OLE).
111    * </p>
112    * Note, <i>the OleBlob should be closed after use</i>.
113    */
114   public OleBlob getBlob(String name) throws IOException;
115 }