View Javadoc

1   // 
2   // Copyright (c) 2003, Caltha - Gajda, Krzewski, Mach, Potempski Sp.J. 
3   // All rights reserved. 
4   // 
5   // Redistribution and use in source and binary forms, with or without modification,  
6   // are permitted provided that the following conditions are met: 
7   //  
8   // * Redistributions of source code must retain the above copyright notice,  
9   //	 this list of conditions and the following disclaimer. 
10  // * Redistributions in binary form must reproduce the above copyright notice,  
11  //	 this list of conditions and the following disclaimer in the documentation  
12  //	 and/or other materials provided with the distribution. 
13  // * Neither the name of the Caltha - Gajda, Krzewski, Mach, Potempski Sp.J.  
14  //	 nor the names of its contributors may be used to endorse or promote products  
15  //	 derived from this software without specific prior written permission. 
16  // 
17  // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"  
18  // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED  
19  // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
20  // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,  
21  // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,  
22  // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
23  // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,  
24  // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)  
25  // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE  
26  // POSSIBILITY OF SUCH DAMAGE. 
27  // 
28  package org.objectledge.database.persistence;
29  
30  import java.math.BigDecimal;
31  import java.net.URL;
32  import java.sql.Array;
33  import java.sql.Blob;
34  import java.sql.Clob;
35  import java.sql.Ref;
36  import java.util.Date;
37  
38  /***
39   * An interface that exposes minimal set methods necessary for retrieving Persistent object 
40   * field information from JDBC database entry.
41   * 
42   * @author <a href="mailto:rafal@caltha.pl">Rafal Krzewski</a>
43   * @version $Id: InputRecord.java,v 1.6 2004/12/27 04:43:24 rafal Exp $
44   */
45  public interface InputRecord
46  {
47      /***
48       * Returns a <code>boolean</code> field value.
49       *
50       * @param field the name of the field.
51       * @return the field value as boolean.
52       * @throws PersistenceException if the field is missing or otherwise unaccessible.
53       */
54      public abstract boolean getBoolean(String field) throws PersistenceException;
55      /***
56       * Returns a <code>byte</code> field value.
57       *
58       * @param field the name of the field.
59       * @return the field value as byte.
60       * @throws PersistenceException if the field is missing or otherwise unaccessible.
61       */
62      public abstract byte getByte(String field) throws PersistenceException;
63      /***
64       * Returns a <code>short</code> field value.
65       *
66       * @param field the name of the field.
67       * @return the field value as short.     
68       * @throws PersistenceException if the field is missing or otherwise unaccessible.
69       */
70      public abstract short getShort(String field) throws PersistenceException;
71      /***
72       * Returns an <code>int</code> field value.
73       *
74       * @param field the name of the field.
75       * @return the field value as integer.
76       * @throws PersistenceException if the field is missing or otherwise unaccessible.
77       */
78      public abstract int getInteger(String field) throws PersistenceException;
79      /***
80       * Returns a <code>long</code> field value.
81       *
82       * @param field the name of the field.
83       * @return the field value as long.
84       * @throws PersistenceException if the field is missing or otherwise unaccessible.
85       */
86      public abstract long getLong(String field) throws PersistenceException;
87      /***
88       * Returns a <code>BigDecimal</code> field value.
89       *
90       * @param field the name of the field.
91       * @return the field value as big decimal.
92       * @throws PersistenceException if the field is missing or otherwise unaccessible.
93       */
94      public abstract BigDecimal getBigDecimal(String field) throws PersistenceException;
95      /***
96       * Returns a <code>float</code> field value.
97       *
98       * @param field the name of the field.
99       * @return the field value as float.
100      * @throws PersistenceException if the field is missing or otherwise unaccessible.
101      */
102     public abstract float getFloat(String field) throws PersistenceException;
103     /***
104      * Returns a <code>double</code> field value.
105      *
106      * @param field the name of the field.
107      * @return the field value as double.
108      * @throws PersistenceException if the field is missing or otherwise unaccessible.
109      */
110     public abstract double getDouble(String field) throws PersistenceException;
111     /***
112      * Returns a <code>String</code> field value.
113      *
114      * @param field the name of the field.
115      * @return the field value as string.
116      * @throws PersistenceException if the field is missing or otherwise unaccessible.
117      */
118     public abstract String getString(String field) throws PersistenceException;
119     /***
120      * Returns a <code>byte</code> array field value.
121      *
122      * <p>String value read from the database will be BASE64 decoded to obtain
123      * byte array.</p>
124      *
125      * @param field the name of the field.
126      * @return the field value as array of byte.
127      * @throws PersistenceException if the field is missing or otherwise unaccessible.
128      */
129     public abstract byte[] getBytes(String field) throws PersistenceException;
130     /***
131      * Returns a <code>Date</code> field value.
132      *
133      * @param field the name of the field.
134      * @return the field value as date.
135      * @throws PersistenceException if the field is missing or otherwise
136      *         unaccessible. 
137      */
138     public abstract Date getDate(String field) throws PersistenceException;
139     /***
140      * gets a <code>Array</code> field value.
141      * 
142      * @param field the name of the field.
143      * @return value the value of the filed.
144      * @throws PersistenceException if the field could not be get to the
145      *         specified value. 
146      */
147     public abstract Array getArray(String field) throws PersistenceException;
148     /***
149      * Returns a <code>Blob</code> field value.
150      * 
151      * @param field the name of the field.
152      * @return value the value of the filed.
153      * @throws PersistenceException if the field could not be get to the
154      *         specified value. 
155      */
156     public abstract Blob getBlob(String field) throws PersistenceException;
157     /***
158      * Returns a <code>Clob</code> field value.
159      * 
160      * @param field the name of the field.
161      * @return value the value of the filed.
162      * @throws PersistenceException if the field could not be get to the
163      *         specified value. 
164      */
165     public abstract Clob getClob(String field) throws PersistenceException;
166     /***
167      * Returns a <code>Ref</code> field value.
168      * 
169      * @param field the name of the field.
170      * @return value the value of the filed.
171      * @throws PersistenceException if the field could not be get to the
172      *         specified value. 
173      */
174     public abstract Ref getRef(String field) throws PersistenceException;
175     /***
176      * Returns a <code>URL</code> field value.
177      * 
178      * @param field the name of the field.
179      * @return value the value of the filed.
180      * @throws PersistenceException if the field could not be get to the
181      *         specified value. 
182      */
183     public abstract URL getURL(String field) throws PersistenceException;
184     /***
185      * Returns a <code>Object</code> field value.
186      * 
187      * @param field the name of the field.
188      * @return value the value of the filed.
189      * @throws PersistenceException if the field could not be get to the
190      *         specified value. 
191      */
192     public abstract Object getObject(String field) throws PersistenceException;
193     /***
194      * Returns <code>true</code> if the field has <code>SQL NULL</code>
195      * value. 
196      *
197      * @param field the name of the field.
198      * @return <code>true</code> if null.
199      * @throws PersistenceException if the field is missing or otherwise
200      *         unaccessible. 
201      */
202     public abstract boolean isNull(String field) throws PersistenceException;
203 }