Home | History | Annotate | Download | only in database
      1 /*
      2  * Copyright (C) 2006 The Android Open Source Project
      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 android.database;
     18 
     19 import android.content.ContentResolver;
     20 import android.database.CharArrayBuffer;
     21 import android.net.Uri;
     22 import android.os.Bundle;
     23 
     24 import java.util.Map;
     25 
     26 /**
     27  * Wrapper class for Cursor that delegates all calls to the actual cursor object
     28  */
     29 
     30 public class CursorWrapper implements Cursor {
     31 
     32     public CursorWrapper(Cursor cursor) {
     33         mCursor = cursor;
     34     }
     35 
     36     /**
     37      * @hide
     38      * @deprecated
     39      */
     40     public void abortUpdates() {
     41         mCursor.abortUpdates();
     42     }
     43 
     44     public void close() {
     45         mCursor.close();
     46     }
     47 
     48     public boolean isClosed() {
     49         return mCursor.isClosed();
     50     }
     51 
     52     /**
     53      * @hide
     54      * @deprecated
     55      */
     56     public boolean commitUpdates() {
     57         return mCursor.commitUpdates();
     58     }
     59 
     60     /**
     61      * @hide
     62      * @deprecated
     63      */
     64     public boolean commitUpdates(
     65             Map<? extends Long, ? extends Map<String, Object>> values) {
     66         return mCursor.commitUpdates(values);
     67     }
     68 
     69     public int getCount() {
     70         return mCursor.getCount();
     71     }
     72 
     73     public void deactivate() {
     74         mCursor.deactivate();
     75     }
     76 
     77     /**
     78      * @hide
     79      * @deprecated
     80      */
     81     public boolean deleteRow() {
     82         return mCursor.deleteRow();
     83     }
     84 
     85     public boolean moveToFirst() {
     86         return mCursor.moveToFirst();
     87     }
     88 
     89     public int getColumnCount() {
     90         return mCursor.getColumnCount();
     91     }
     92 
     93     public int getColumnIndex(String columnName) {
     94         return mCursor.getColumnIndex(columnName);
     95     }
     96 
     97     public int getColumnIndexOrThrow(String columnName)
     98             throws IllegalArgumentException {
     99         return mCursor.getColumnIndexOrThrow(columnName);
    100     }
    101 
    102     public String getColumnName(int columnIndex) {
    103          return mCursor.getColumnName(columnIndex);
    104     }
    105 
    106     public String[] getColumnNames() {
    107         return mCursor.getColumnNames();
    108     }
    109 
    110     public double getDouble(int columnIndex) {
    111         return mCursor.getDouble(columnIndex);
    112     }
    113 
    114     public Bundle getExtras() {
    115         return mCursor.getExtras();
    116     }
    117 
    118     public float getFloat(int columnIndex) {
    119         return mCursor.getFloat(columnIndex);
    120     }
    121 
    122     public int getInt(int columnIndex) {
    123         return mCursor.getInt(columnIndex);
    124     }
    125 
    126     public long getLong(int columnIndex) {
    127         return mCursor.getLong(columnIndex);
    128     }
    129 
    130     public short getShort(int columnIndex) {
    131         return mCursor.getShort(columnIndex);
    132     }
    133 
    134     public String getString(int columnIndex) {
    135         return mCursor.getString(columnIndex);
    136     }
    137 
    138     public void copyStringToBuffer(int columnIndex, CharArrayBuffer buffer) {
    139         mCursor.copyStringToBuffer(columnIndex, buffer);
    140     }
    141 
    142     public byte[] getBlob(int columnIndex) {
    143         return mCursor.getBlob(columnIndex);
    144     }
    145 
    146     public boolean getWantsAllOnMoveCalls() {
    147         return mCursor.getWantsAllOnMoveCalls();
    148     }
    149 
    150     /**
    151      * @hide
    152      * @deprecated
    153      */
    154     public boolean hasUpdates() {
    155         return mCursor.hasUpdates();
    156     }
    157 
    158     public boolean isAfterLast() {
    159         return mCursor.isAfterLast();
    160     }
    161 
    162     public boolean isBeforeFirst() {
    163         return mCursor.isBeforeFirst();
    164     }
    165 
    166     public boolean isFirst() {
    167         return mCursor.isFirst();
    168     }
    169 
    170     public boolean isLast() {
    171         return mCursor.isLast();
    172     }
    173 
    174     public boolean isNull(int columnIndex) {
    175         return mCursor.isNull(columnIndex);
    176     }
    177 
    178     public boolean moveToLast() {
    179         return mCursor.moveToLast();
    180     }
    181 
    182     public boolean move(int offset) {
    183         return mCursor.move(offset);
    184     }
    185 
    186     public boolean moveToPosition(int position) {
    187         return mCursor.moveToPosition(position);
    188     }
    189 
    190     public boolean moveToNext() {
    191         return mCursor.moveToNext();
    192     }
    193 
    194     public int getPosition() {
    195         return mCursor.getPosition();
    196     }
    197 
    198     public boolean moveToPrevious() {
    199         return mCursor.moveToPrevious();
    200     }
    201 
    202     public void registerContentObserver(ContentObserver observer) {
    203         mCursor.registerContentObserver(observer);
    204     }
    205 
    206     public void registerDataSetObserver(DataSetObserver observer) {
    207         mCursor.registerDataSetObserver(observer);
    208     }
    209 
    210     public boolean requery() {
    211         return mCursor.requery();
    212     }
    213 
    214     public Bundle respond(Bundle extras) {
    215         return mCursor.respond(extras);
    216     }
    217 
    218     public void setNotificationUri(ContentResolver cr, Uri uri) {
    219         mCursor.setNotificationUri(cr, uri);
    220     }
    221 
    222     /**
    223      * @hide
    224      * @deprecated
    225      */
    226     public boolean supportsUpdates() {
    227         return mCursor.supportsUpdates();
    228     }
    229 
    230     public void unregisterContentObserver(ContentObserver observer) {
    231         mCursor.unregisterContentObserver(observer);
    232     }
    233 
    234     public void unregisterDataSetObserver(DataSetObserver observer) {
    235         mCursor.unregisterDataSetObserver(observer);
    236     }
    237 
    238     /**
    239      * @hide
    240      * @deprecated
    241      */
    242     public boolean updateDouble(int columnIndex, double value) {
    243         return mCursor.updateDouble(columnIndex, value);
    244     }
    245 
    246     /**
    247      * @hide
    248      * @deprecated
    249      */
    250     public boolean updateFloat(int columnIndex, float value) {
    251         return mCursor.updateFloat(columnIndex, value);
    252     }
    253 
    254     /**
    255      * @hide
    256      * @deprecated
    257      */
    258     public boolean updateInt(int columnIndex, int value) {
    259         return mCursor.updateInt(columnIndex, value);
    260     }
    261 
    262     /**
    263      * @hide
    264      * @deprecated
    265      */
    266     public boolean updateLong(int columnIndex, long value) {
    267         return mCursor.updateLong(columnIndex, value);
    268     }
    269 
    270     /**
    271      * @hide
    272      * @deprecated
    273      */
    274     public boolean updateShort(int columnIndex, short value) {
    275         return mCursor.updateShort(columnIndex, value);
    276     }
    277 
    278     /**
    279      * @hide
    280      * @deprecated
    281      */
    282     public boolean updateString(int columnIndex, String value) {
    283         return mCursor.updateString(columnIndex, value);
    284     }
    285 
    286     /**
    287      * @hide
    288      * @deprecated
    289      */
    290     public boolean updateBlob(int columnIndex, byte[] value) {
    291         return mCursor.updateBlob(columnIndex, value);
    292     }
    293 
    294     /**
    295      * @hide
    296      * @deprecated
    297      */
    298     public boolean updateToNull(int columnIndex) {
    299         return mCursor.updateToNull(columnIndex);
    300     }
    301 
    302     private Cursor mCursor;
    303 
    304 }
    305 
    306