Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c6654dc authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Add some simple annotations to Cursor."

parents 1eeed7a3 d0c8cdd7
Loading
Loading
Loading
Loading
+40 −40
Original line number Original line Diff line number Diff line
@@ -13077,38 +13077,38 @@ package android.database {
  public interface Cursor extends java.io.Closeable {
  public interface Cursor extends java.io.Closeable {
    method public void close();
    method public void close();
    method public void copyStringToBuffer(int, android.database.CharArrayBuffer);
    method public void copyStringToBuffer(@IntRange(from=0) int, android.database.CharArrayBuffer);
    method @Deprecated public void deactivate();
    method @Deprecated public void deactivate();
    method public byte[] getBlob(int);
    method public byte[] getBlob(@IntRange(from=0) int);
    method public int getColumnCount();
    method @IntRange(from=0) public int getColumnCount();
    method public int getColumnIndex(String);
    method @IntRange(from=0xffffffff) public int getColumnIndex(String);
    method public int getColumnIndexOrThrow(String) throws java.lang.IllegalArgumentException;
    method @IntRange(from=0) public int getColumnIndexOrThrow(String) throws java.lang.IllegalArgumentException;
    method public String getColumnName(int);
    method public String getColumnName(@IntRange(from=0) int);
    method public String[] getColumnNames();
    method public String[] getColumnNames();
    method public int getCount();
    method @IntRange(from=0) public int getCount();
    method public double getDouble(int);
    method public double getDouble(@IntRange(from=0) int);
    method public android.os.Bundle getExtras();
    method public android.os.Bundle getExtras();
    method public float getFloat(int);
    method public float getFloat(@IntRange(from=0) int);
    method public int getInt(int);
    method public int getInt(@IntRange(from=0) int);
    method public long getLong(int);
    method public long getLong(@IntRange(from=0) int);
    method public android.net.Uri getNotificationUri();
    method public android.net.Uri getNotificationUri();
    method @Nullable public default java.util.List<android.net.Uri> getNotificationUris();
    method @Nullable public default java.util.List<android.net.Uri> getNotificationUris();
    method public int getPosition();
    method @IntRange(from=0xffffffff) public int getPosition();
    method public short getShort(int);
    method public short getShort(@IntRange(from=0) int);
    method public String getString(int);
    method public String getString(@IntRange(from=0) int);
    method public int getType(int);
    method public int getType(@IntRange(from=0) int);
    method public boolean getWantsAllOnMoveCalls();
    method public boolean getWantsAllOnMoveCalls();
    method public boolean isAfterLast();
    method public boolean isAfterLast();
    method public boolean isBeforeFirst();
    method public boolean isBeforeFirst();
    method public boolean isClosed();
    method public boolean isClosed();
    method public boolean isFirst();
    method public boolean isFirst();
    method public boolean isLast();
    method public boolean isLast();
    method public boolean isNull(int);
    method public boolean isNull(@IntRange(from=0) int);
    method public boolean move(int);
    method public boolean move(int);
    method public boolean moveToFirst();
    method public boolean moveToFirst();
    method public boolean moveToLast();
    method public boolean moveToLast();
    method public boolean moveToNext();
    method public boolean moveToNext();
    method public boolean moveToPosition(int);
    method public boolean moveToPosition(@IntRange(from=0xffffffff) int);
    method public boolean moveToPrevious();
    method public boolean moveToPrevious();
    method public void registerContentObserver(android.database.ContentObserver);
    method public void registerContentObserver(android.database.ContentObserver);
    method public void registerDataSetObserver(android.database.DataSetObserver);
    method public void registerDataSetObserver(android.database.DataSetObserver);
@@ -13150,33 +13150,33 @@ package android.database {
    ctor @Deprecated public CursorWindow(boolean);
    ctor @Deprecated public CursorWindow(boolean);
    method public boolean allocRow();
    method public boolean allocRow();
    method public void clear();
    method public void clear();
    method public void copyStringToBuffer(int, int, android.database.CharArrayBuffer);
    method public void copyStringToBuffer(@IntRange(from=0) int, @IntRange(from=0) int, android.database.CharArrayBuffer);
    method public int describeContents();
    method public int describeContents();
    method public void freeLastRow();
    method public void freeLastRow();
    method public byte[] getBlob(int, int);
    method public byte[] getBlob(@IntRange(from=0) int, @IntRange(from=0) int);
    method public double getDouble(int, int);
    method public double getDouble(@IntRange(from=0) int, @IntRange(from=0) int);
    method public float getFloat(int, int);
    method public float getFloat(@IntRange(from=0) int, @IntRange(from=0) int);
    method public int getInt(int, int);
    method public int getInt(@IntRange(from=0) int, @IntRange(from=0) int);
    method public long getLong(int, int);
    method public long getLong(@IntRange(from=0) int, @IntRange(from=0) int);
    method public int getNumRows();
    method @IntRange(from=0) public int getNumRows();
    method public short getShort(int, int);
    method public short getShort(@IntRange(from=0) int, @IntRange(from=0) int);
    method public int getStartPosition();
    method @IntRange(from=0) public int getStartPosition();
    method public String getString(int, int);
    method public String getString(@IntRange(from=0) int, @IntRange(from=0) int);
    method public int getType(int, int);
    method public int getType(@IntRange(from=0) int, @IntRange(from=0) int);
    method @Deprecated public boolean isBlob(int, int);
    method @Deprecated public boolean isBlob(@IntRange(from=0) int, @IntRange(from=0) int);
    method @Deprecated public boolean isFloat(int, int);
    method @Deprecated public boolean isFloat(@IntRange(from=0) int, @IntRange(from=0) int);
    method @Deprecated public boolean isLong(int, int);
    method @Deprecated public boolean isLong(@IntRange(from=0) int, @IntRange(from=0) int);
    method @Deprecated public boolean isNull(int, int);
    method @Deprecated public boolean isNull(@IntRange(from=0) int, @IntRange(from=0) int);
    method @Deprecated public boolean isString(int, int);
    method @Deprecated public boolean isString(@IntRange(from=0) int, @IntRange(from=0) int);
    method public static android.database.CursorWindow newFromParcel(android.os.Parcel);
    method public static android.database.CursorWindow newFromParcel(android.os.Parcel);
    method protected void onAllReferencesReleased();
    method protected void onAllReferencesReleased();
    method public boolean putBlob(byte[], int, int);
    method public boolean putBlob(byte[], @IntRange(from=0) int, @IntRange(from=0) int);
    method public boolean putDouble(double, int, int);
    method public boolean putDouble(double, @IntRange(from=0) int, @IntRange(from=0) int);
    method public boolean putLong(long, int, int);
    method public boolean putLong(long, @IntRange(from=0) int, @IntRange(from=0) int);
    method public boolean putNull(int, int);
    method public boolean putNull(@IntRange(from=0) int, @IntRange(from=0) int);
    method public boolean putString(String, int, int);
    method public boolean putString(String, @IntRange(from=0) int, @IntRange(from=0) int);
    method public boolean setNumColumns(int);
    method public boolean setNumColumns(@IntRange(from=0) int);
    method public void setStartPosition(int);
    method public void setStartPosition(@IntRange(from=0) int);
    method public void writeToParcel(android.os.Parcel, int);
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.database.CursorWindow> CREATOR;
    field @NonNull public static final android.os.Parcelable.Creator<android.database.CursorWindow> CREATOR;
  }
  }
+33 −27
Original line number Original line Diff line number Diff line
@@ -16,6 +16,8 @@


package android.database;
package android.database;


import android.annotation.IntDef;
import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.content.ContentResolver;
import android.content.ContentResolver;
@@ -23,6 +25,8 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.Bundle;


import java.io.Closeable;
import java.io.Closeable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Arrays;
import java.util.Arrays;
import java.util.List;
import java.util.List;


@@ -56,12 +60,23 @@ public interface Cursor extends Closeable {
    /** Value returned by {@link #getType(int)} if the specified column type is blob */
    /** Value returned by {@link #getType(int)} if the specified column type is blob */
    static final int FIELD_TYPE_BLOB = 4;
    static final int FIELD_TYPE_BLOB = 4;


    /** @hide */
    @IntDef(prefix = { "FIELD_TYPE_" }, value = {
            FIELD_TYPE_NULL,
            FIELD_TYPE_INTEGER,
            FIELD_TYPE_FLOAT,
            FIELD_TYPE_STRING,
            FIELD_TYPE_BLOB,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface FieldType {}

    /**
    /**
     * Returns the numbers of rows in the cursor.
     * Returns the numbers of rows in the cursor.
     *
     *
     * @return the number of rows in the cursor.
     * @return the number of rows in the cursor.
     */
     */
    int getCount();
    @IntRange(from = 0) int getCount();


    /**
    /**
     * Returns the current position of the cursor in the row set.
     * Returns the current position of the cursor in the row set.
@@ -72,7 +87,7 @@ public interface Cursor extends Closeable {
     *
     *
     * @return the current cursor position.
     * @return the current cursor position.
     */
     */
    int getPosition();
    @IntRange(from = -1) int getPosition();


    /**
    /**
     * Move the cursor by a relative amount, forward or backward, from the
     * Move the cursor by a relative amount, forward or backward, from the
@@ -101,7 +116,7 @@ public interface Cursor extends Closeable {
     * @param position the zero-based position to move to.
     * @param position the zero-based position to move to.
     * @return whether the requested move fully succeeded.
     * @return whether the requested move fully succeeded.
     */
     */
    boolean moveToPosition(int position);
    boolean moveToPosition(@IntRange(from = -1) int position);


    /**
    /**
     * Move the cursor to the first row.
     * Move the cursor to the first row.
@@ -181,7 +196,7 @@ public interface Cursor extends Closeable {
     * the column name does not exist.
     * the column name does not exist.
     * @see #getColumnIndexOrThrow(String)
     * @see #getColumnIndexOrThrow(String)
     */
     */
    int getColumnIndex(String columnName);
    @IntRange(from = -1) int getColumnIndex(String columnName);


    /**
    /**
     * Returns the zero-based index for the given column name, or throws
     * Returns the zero-based index for the given column name, or throws
@@ -194,7 +209,8 @@ public interface Cursor extends Closeable {
     * @see #getColumnIndex(String)
     * @see #getColumnIndex(String)
     * @throws IllegalArgumentException if the column does not exist
     * @throws IllegalArgumentException if the column does not exist
     */
     */
    int getColumnIndexOrThrow(String columnName) throws IllegalArgumentException;
    @IntRange(from = 0) int getColumnIndexOrThrow(String columnName)
            throws IllegalArgumentException;


    /**
    /**
     * Returns the column name at the given zero-based column index.
     * Returns the column name at the given zero-based column index.
@@ -202,7 +218,7 @@ public interface Cursor extends Closeable {
     * @param columnIndex the zero-based index of the target column.
     * @param columnIndex the zero-based index of the target column.
     * @return the column name for the given column index.
     * @return the column name for the given column index.
     */
     */
    String getColumnName(int columnIndex);
    String getColumnName(@IntRange(from = 0) int columnIndex);


    /**
    /**
     * Returns a string array holding the names of all of the columns in the
     * Returns a string array holding the names of all of the columns in the
@@ -216,7 +232,7 @@ public interface Cursor extends Closeable {
     * Return total number of columns
     * Return total number of columns
     * @return number of columns 
     * @return number of columns 
     */
     */
    int getColumnCount();
    @IntRange(from = 0) int getColumnCount();
    
    
    /**
    /**
     * Returns the value of the requested column as a byte array.
     * Returns the value of the requested column as a byte array.
@@ -228,7 +244,7 @@ public interface Cursor extends Closeable {
     * @param columnIndex the zero-based index of the target column.
     * @param columnIndex the zero-based index of the target column.
     * @return the value of that column as a byte array.
     * @return the value of that column as a byte array.
     */
     */
    byte[] getBlob(int columnIndex);
    byte[] getBlob(@IntRange(from = 0) int columnIndex);


    /**
    /**
     * Returns the value of the requested column as a String.
     * Returns the value of the requested column as a String.
@@ -240,7 +256,7 @@ public interface Cursor extends Closeable {
     * @param columnIndex the zero-based index of the target column.
     * @param columnIndex the zero-based index of the target column.
     * @return the value of that column as a String.
     * @return the value of that column as a String.
     */
     */
    String getString(int columnIndex);
    String getString(@IntRange(from = 0) int columnIndex);
    
    
    /**
    /**
     * Retrieves the requested column text and stores it in the buffer provided.
     * Retrieves the requested column text and stores it in the buffer provided.
@@ -250,7 +266,7 @@ public interface Cursor extends Closeable {
     *        if the target column is null, return buffer
     *        if the target column is null, return buffer
     * @param buffer the buffer to copy the text into. 
     * @param buffer the buffer to copy the text into. 
     */
     */
    void copyStringToBuffer(int columnIndex, CharArrayBuffer buffer);
    void copyStringToBuffer(@IntRange(from = 0) int columnIndex, CharArrayBuffer buffer);
    
    
    /**
    /**
     * Returns the value of the requested column as a short.
     * Returns the value of the requested column as a short.
@@ -263,7 +279,7 @@ public interface Cursor extends Closeable {
     * @param columnIndex the zero-based index of the target column.
     * @param columnIndex the zero-based index of the target column.
     * @return the value of that column as a short.
     * @return the value of that column as a short.
     */
     */
    short getShort(int columnIndex);
    short getShort(@IntRange(from = 0) int columnIndex);


    /**
    /**
     * Returns the value of the requested column as an int.
     * Returns the value of the requested column as an int.
@@ -276,7 +292,7 @@ public interface Cursor extends Closeable {
     * @param columnIndex the zero-based index of the target column.
     * @param columnIndex the zero-based index of the target column.
     * @return the value of that column as an int.
     * @return the value of that column as an int.
     */
     */
    int getInt(int columnIndex);
    int getInt(@IntRange(from = 0) int columnIndex);


    /**
    /**
     * Returns the value of the requested column as a long.
     * Returns the value of the requested column as a long.
@@ -289,7 +305,7 @@ public interface Cursor extends Closeable {
     * @param columnIndex the zero-based index of the target column.
     * @param columnIndex the zero-based index of the target column.
     * @return the value of that column as a long.
     * @return the value of that column as a long.
     */
     */
    long getLong(int columnIndex);
    long getLong(@IntRange(from = 0) int columnIndex);


    /**
    /**
     * Returns the value of the requested column as a float.
     * Returns the value of the requested column as a float.
@@ -302,7 +318,7 @@ public interface Cursor extends Closeable {
     * @param columnIndex the zero-based index of the target column.
     * @param columnIndex the zero-based index of the target column.
     * @return the value of that column as a float.
     * @return the value of that column as a float.
     */
     */
    float getFloat(int columnIndex);
    float getFloat(@IntRange(from = 0) int columnIndex);


    /**
    /**
     * Returns the value of the requested column as a double.
     * Returns the value of the requested column as a double.
@@ -315,28 +331,18 @@ public interface Cursor extends Closeable {
     * @param columnIndex the zero-based index of the target column.
     * @param columnIndex the zero-based index of the target column.
     * @return the value of that column as a double.
     * @return the value of that column as a double.
     */
     */
    double getDouble(int columnIndex);
    double getDouble(@IntRange(from = 0) int columnIndex);


    /**
    /**
     * Returns data type of the given column's value.
     * Returns data type of the given column's value.
     * The preferred type of the column is returned but the data may be converted to other types
     * The preferred type of the column is returned but the data may be converted to other types
     * as documented in the get-type methods such as {@link #getInt(int)}, {@link #getFloat(int)}
     * as documented in the get-type methods such as {@link #getInt(int)}, {@link #getFloat(int)}
     * etc.
     * etc.
     *<p>
     * Returned column types are
     * <ul>
     *   <li>{@link #FIELD_TYPE_NULL}</li>
     *   <li>{@link #FIELD_TYPE_INTEGER}</li>
     *   <li>{@link #FIELD_TYPE_FLOAT}</li>
     *   <li>{@link #FIELD_TYPE_STRING}</li>
     *   <li>{@link #FIELD_TYPE_BLOB}</li>
     *</ul>
     *</p>
     *
     *
     * @param columnIndex the zero-based index of the target column.
     * @param columnIndex the zero-based index of the target column.
     * @return column value type
     * @return column value type
     */
     */
    int getType(int columnIndex);
    @FieldType int getType(@IntRange(from = 0) int columnIndex);


    /**
    /**
     * Returns <code>true</code> if the value in the indicated column is null.
     * Returns <code>true</code> if the value in the indicated column is null.
@@ -344,7 +350,7 @@ public interface Cursor extends Closeable {
     * @param columnIndex the zero-based index of the target column.
     * @param columnIndex the zero-based index of the target column.
     * @return whether the column value is null.
     * @return whether the column value is null.
     */
     */
    boolean isNull(int columnIndex);
    boolean isNull(@IntRange(from = 0) int columnIndex);


    /**
    /**
     * Deactivates the Cursor, making all calls on it fail until {@link #requery} is called.
     * Deactivates the Cursor, making all calls on it fail until {@link #requery} is called.
+30 −33
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
package android.database;
package android.database;


import android.annotation.BytesLong;
import android.annotation.BytesLong;
import android.annotation.IntRange;
import android.compat.annotation.UnsupportedAppUsage;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.res.Resources;
import android.content.res.Resources;
import android.database.sqlite.SQLiteClosable;
import android.database.sqlite.SQLiteClosable;
@@ -230,7 +231,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
     *
     *
     * @return The zero-based start position.
     * @return The zero-based start position.
     */
     */
    public int getStartPosition() {
    public @IntRange(from = 0) int getStartPosition() {
        return mStartPos;
        return mStartPos;
    }
    }


@@ -243,7 +244,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
     *
     *
     * @param pos The new zero-based start position.
     * @param pos The new zero-based start position.
     */
     */
    public void setStartPosition(int pos) {
    public void setStartPosition(@IntRange(from = 0) int pos) {
        mStartPos = pos;
        mStartPos = pos;
    }
    }


@@ -252,7 +253,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
     *
     *
     * @return The number of rows in this cursor window.
     * @return The number of rows in this cursor window.
     */
     */
    public int getNumRows() {
    public @IntRange(from = 0) int getNumRows() {
        acquireReference();
        acquireReference();
        try {
        try {
            return nativeGetNumRows(mWindowPtr);
            return nativeGetNumRows(mWindowPtr);
@@ -272,7 +273,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
     * @param columnNum The new number of columns.
     * @param columnNum The new number of columns.
     * @return True if successful.
     * @return True if successful.
     */
     */
    public boolean setNumColumns(int columnNum) {
    public boolean setNumColumns(@IntRange(from = 0) int columnNum) {
        acquireReference();
        acquireReference();
        try {
        try {
            return nativeSetNumColumns(mWindowPtr, columnNum);
            return nativeSetNumColumns(mWindowPtr, columnNum);
@@ -317,7 +318,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
     * @deprecated Use {@link #getType(int, int)} instead.
     * @deprecated Use {@link #getType(int, int)} instead.
     */
     */
    @Deprecated
    @Deprecated
    public boolean isNull(int row, int column) {
    public boolean isNull(@IntRange(from = 0) int row, @IntRange(from = 0) int column) {
        return getType(row, column) == Cursor.FIELD_TYPE_NULL;
        return getType(row, column) == Cursor.FIELD_TYPE_NULL;
    }
    }


@@ -332,7 +333,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
     * @deprecated Use {@link #getType(int, int)} instead.
     * @deprecated Use {@link #getType(int, int)} instead.
     */
     */
    @Deprecated
    @Deprecated
    public boolean isBlob(int row, int column) {
    public boolean isBlob(@IntRange(from = 0) int row, @IntRange(from = 0) int column) {
        int type = getType(row, column);
        int type = getType(row, column);
        return type == Cursor.FIELD_TYPE_BLOB || type == Cursor.FIELD_TYPE_NULL;
        return type == Cursor.FIELD_TYPE_BLOB || type == Cursor.FIELD_TYPE_NULL;
    }
    }
@@ -347,7 +348,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
     * @deprecated Use {@link #getType(int, int)} instead.
     * @deprecated Use {@link #getType(int, int)} instead.
     */
     */
    @Deprecated
    @Deprecated
    public boolean isLong(int row, int column) {
    public boolean isLong(@IntRange(from = 0) int row, @IntRange(from = 0) int column) {
        return getType(row, column) == Cursor.FIELD_TYPE_INTEGER;
        return getType(row, column) == Cursor.FIELD_TYPE_INTEGER;
    }
    }


@@ -361,7 +362,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
     * @deprecated Use {@link #getType(int, int)} instead.
     * @deprecated Use {@link #getType(int, int)} instead.
     */
     */
    @Deprecated
    @Deprecated
    public boolean isFloat(int row, int column) {
    public boolean isFloat(@IntRange(from = 0) int row, @IntRange(from = 0) int column) {
        return getType(row, column) == Cursor.FIELD_TYPE_FLOAT;
        return getType(row, column) == Cursor.FIELD_TYPE_FLOAT;
    }
    }


@@ -376,29 +377,20 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
     * @deprecated Use {@link #getType(int, int)} instead.
     * @deprecated Use {@link #getType(int, int)} instead.
     */
     */
    @Deprecated
    @Deprecated
    public boolean isString(int row, int column) {
    public boolean isString(@IntRange(from = 0) int row, @IntRange(from = 0) int column) {
        int type = getType(row, column);
        int type = getType(row, column);
        return type == Cursor.FIELD_TYPE_STRING || type == Cursor.FIELD_TYPE_NULL;
        return type == Cursor.FIELD_TYPE_STRING || type == Cursor.FIELD_TYPE_NULL;
    }
    }


    /**
    /**
     * Returns the type of the field at the specified row and column index.
     * Returns the type of the field at the specified row and column index.
     * <p>
     * The returned field types are:
     * <ul>
     * <li>{@link Cursor#FIELD_TYPE_NULL}</li>
     * <li>{@link Cursor#FIELD_TYPE_INTEGER}</li>
     * <li>{@link Cursor#FIELD_TYPE_FLOAT}</li>
     * <li>{@link Cursor#FIELD_TYPE_STRING}</li>
     * <li>{@link Cursor#FIELD_TYPE_BLOB}</li>
     * </ul>
     * </p>
     *
     *
     * @param row The zero-based row index.
     * @param row The zero-based row index.
     * @param column The zero-based column index.
     * @param column The zero-based column index.
     * @return The field type.
     * @return The field type.
     */
     */
    public int getType(int row, int column) {
    public @Cursor.FieldType int getType(@IntRange(from = 0) int row,
            @IntRange(from = 0) int column) {
        acquireReference();
        acquireReference();
        try {
        try {
            return nativeGetType(mWindowPtr, row - mStartPos, column);
            return nativeGetType(mWindowPtr, row - mStartPos, column);
@@ -428,7 +420,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
     * @param column The zero-based column index.
     * @param column The zero-based column index.
     * @return The value of the field as a byte array.
     * @return The value of the field as a byte array.
     */
     */
    public byte[] getBlob(int row, int column) {
    public byte[] getBlob(@IntRange(from = 0) int row, @IntRange(from = 0) int column) {
        acquireReference();
        acquireReference();
        try {
        try {
            return nativeGetBlob(mWindowPtr, row - mStartPos, column);
            return nativeGetBlob(mWindowPtr, row - mStartPos, column);
@@ -463,7 +455,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
     * @param column The zero-based column index.
     * @param column The zero-based column index.
     * @return The value of the field as a string.
     * @return The value of the field as a string.
     */
     */
    public String getString(int row, int column) {
    public String getString(@IntRange(from = 0) int row, @IntRange(from = 0) int column) {
        acquireReference();
        acquireReference();
        try {
        try {
            return nativeGetString(mWindowPtr, row - mStartPos, column);
            return nativeGetString(mWindowPtr, row - mStartPos, column);
@@ -502,7 +494,8 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
     * @param buffer The {@link CharArrayBuffer} to hold the string.  It is automatically
     * @param buffer The {@link CharArrayBuffer} to hold the string.  It is automatically
     * resized if the requested string is larger than the buffer's current capacity.
     * resized if the requested string is larger than the buffer's current capacity.
      */
      */
    public void copyStringToBuffer(int row, int column, CharArrayBuffer buffer) {
    public void copyStringToBuffer(@IntRange(from = 0) int row, @IntRange(from = 0) int column,
            CharArrayBuffer buffer) {
        if (buffer == null) {
        if (buffer == null) {
            throw new IllegalArgumentException("CharArrayBuffer should not be null");
            throw new IllegalArgumentException("CharArrayBuffer should not be null");
        }
        }
@@ -536,7 +529,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
     * @param column The zero-based column index.
     * @param column The zero-based column index.
     * @return The value of the field as a <code>long</code>.
     * @return The value of the field as a <code>long</code>.
     */
     */
    public long getLong(int row, int column) {
    public long getLong(@IntRange(from = 0) int row, @IntRange(from = 0) int column) {
        acquireReference();
        acquireReference();
        try {
        try {
            return nativeGetLong(mWindowPtr, row - mStartPos, column);
            return nativeGetLong(mWindowPtr, row - mStartPos, column);
@@ -568,7 +561,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
     * @param column The zero-based column index.
     * @param column The zero-based column index.
     * @return The value of the field as a <code>double</code>.
     * @return The value of the field as a <code>double</code>.
     */
     */
    public double getDouble(int row, int column) {
    public double getDouble(@IntRange(from = 0) int row, @IntRange(from = 0) int column) {
        acquireReference();
        acquireReference();
        try {
        try {
            return nativeGetDouble(mWindowPtr, row - mStartPos, column);
            return nativeGetDouble(mWindowPtr, row - mStartPos, column);
@@ -589,7 +582,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
     * @param column The zero-based column index.
     * @param column The zero-based column index.
     * @return The value of the field as a <code>short</code>.
     * @return The value of the field as a <code>short</code>.
     */
     */
    public short getShort(int row, int column) {
    public short getShort(@IntRange(from = 0) int row, @IntRange(from = 0) int column) {
        return (short) getLong(row, column);
        return (short) getLong(row, column);
    }
    }


@@ -605,7 +598,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
     * @param column The zero-based column index.
     * @param column The zero-based column index.
     * @return The value of the field as an <code>int</code>.
     * @return The value of the field as an <code>int</code>.
     */
     */
    public int getInt(int row, int column) {
    public int getInt(@IntRange(from = 0) int row, @IntRange(from = 0) int column) {
        return (int) getLong(row, column);
        return (int) getLong(row, column);
    }
    }


@@ -621,7 +614,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
     * @param column The zero-based column index.
     * @param column The zero-based column index.
     * @return The value of the field as an <code>float</code>.
     * @return The value of the field as an <code>float</code>.
     */
     */
    public float getFloat(int row, int column) {
    public float getFloat(@IntRange(from = 0) int row, @IntRange(from = 0) int column) {
        return (float) getDouble(row, column);
        return (float) getDouble(row, column);
    }
    }


@@ -633,7 +626,8 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
     * @param column The zero-based column index.
     * @param column The zero-based column index.
     * @return True if successful.
     * @return True if successful.
     */
     */
    public boolean putBlob(byte[] value, int row, int column) {
    public boolean putBlob(byte[] value,
            @IntRange(from = 0) int row, @IntRange(from = 0) int column) {
        acquireReference();
        acquireReference();
        try {
        try {
            return nativePutBlob(mWindowPtr, value, row - mStartPos, column);
            return nativePutBlob(mWindowPtr, value, row - mStartPos, column);
@@ -650,7 +644,8 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
     * @param column The zero-based column index.
     * @param column The zero-based column index.
     * @return True if successful.
     * @return True if successful.
     */
     */
    public boolean putString(String value, int row, int column) {
    public boolean putString(String value,
            @IntRange(from = 0) int row, @IntRange(from = 0) int column) {
        acquireReference();
        acquireReference();
        try {
        try {
            return nativePutString(mWindowPtr, value, row - mStartPos, column);
            return nativePutString(mWindowPtr, value, row - mStartPos, column);
@@ -667,7 +662,8 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
     * @param column The zero-based column index.
     * @param column The zero-based column index.
     * @return True if successful.
     * @return True if successful.
     */
     */
    public boolean putLong(long value, int row, int column) {
    public boolean putLong(long value,
            @IntRange(from = 0) int row, @IntRange(from = 0) int column) {
        acquireReference();
        acquireReference();
        try {
        try {
            return nativePutLong(mWindowPtr, value, row - mStartPos, column);
            return nativePutLong(mWindowPtr, value, row - mStartPos, column);
@@ -685,7 +681,8 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
     * @param column The zero-based column index.
     * @param column The zero-based column index.
     * @return True if successful.
     * @return True if successful.
     */
     */
    public boolean putDouble(double value, int row, int column) {
    public boolean putDouble(double value,
            @IntRange(from = 0) int row, @IntRange(from = 0) int column) {
        acquireReference();
        acquireReference();
        try {
        try {
            return nativePutDouble(mWindowPtr, value, row - mStartPos, column);
            return nativePutDouble(mWindowPtr, value, row - mStartPos, column);
@@ -701,7 +698,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable {
     * @param column The zero-based column index.
     * @param column The zero-based column index.
     * @return True if successful.
     * @return True if successful.
     */
     */
    public boolean putNull(int row, int column) {
    public boolean putNull(@IntRange(from = 0) int row, @IntRange(from = 0) int column) {
        acquireReference();
        acquireReference();
        try {
        try {
            return nativePutNull(mWindowPtr, row - mStartPos, column);
            return nativePutNull(mWindowPtr, row - mStartPos, column);
+40 −40

File changed.

Preview size limit exceeded, changes collapsed.