Skip to content

Commit ff3e27b

Browse files
kurtisnelsonrogerhu
authored andcommitted
Annotate nullable methods on ParseObject
This makes the object linter/Kotlin friendly.
1 parent e86b920 commit ff3e27b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Parse/src/main/java/com/parse/ParseObject.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import android.os.Bundle;
1212
import android.os.Parcel;
1313
import android.os.Parcelable;
14+
import android.support.annotation.NonNull;
15+
import android.support.annotation.Nullable;
1416
import android.util.Log;
1517

1618
import org.json.JSONArray;
@@ -3168,6 +3170,7 @@ public boolean containsKey(String key) {
31683170
* The key to access the value for.
31693171
* @return {@code null} if there is no such key or if it is not a {@link String}.
31703172
*/
3173+
@Nullable
31713174
public String getString(String key) {
31723175
synchronized (mutex) {
31733176
checkGetAccess(key);
@@ -3186,6 +3189,7 @@ public String getString(String key) {
31863189
* The key to access the value for.
31873190
* @return {@code null} if there is no such key or if it is not a {@code byte[]}.
31883191
*/
3192+
@Nullable
31893193
public byte[] getBytes(String key) {
31903194
synchronized (mutex) {
31913195
checkGetAccess(key);
@@ -3205,6 +3209,7 @@ public byte[] getBytes(String key) {
32053209
* The key to access the value for.
32063210
* @return {@code null} if there is no such key or if it is not a {@link Number}.
32073211
*/
3212+
@Nullable
32083213
public Number getNumber(String key) {
32093214
synchronized (mutex) {
32103215
checkGetAccess(key);
@@ -3223,6 +3228,7 @@ public Number getNumber(String key) {
32233228
* The key to access the value for.
32243229
* @return {@code null} if there is no such key or if it is not a {@link JSONArray}.
32253230
*/
3231+
@Nullable
32263232
public JSONArray getJSONArray(String key) {
32273233
synchronized (mutex) {
32283234
checkGetAccess(key);
@@ -3247,6 +3253,7 @@ public JSONArray getJSONArray(String key) {
32473253
* @return {@code null} if there is no such key or if the value can't be converted to a
32483254
* {@link List}.
32493255
*/
3256+
@Nullable
32503257
public <T> List<T> getList(String key) {
32513258
synchronized (mutex) {
32523259
Object value = estimatedData.get(key);
@@ -3267,6 +3274,7 @@ public <T> List<T> getList(String key) {
32673274
* @return {@code null} if there is no such key or if the value can't be converted to a
32683275
* {@link Map}.
32693276
*/
3277+
@Nullable
32703278
public <V> Map<String, V> getMap(String key) {
32713279
synchronized (mutex) {
32723280
Object value = estimatedData.get(key);
@@ -3286,6 +3294,7 @@ public <V> Map<String, V> getMap(String key) {
32863294
* The key to access the value for.
32873295
* @return {@code null} if there is no such key or if it is not a {@link JSONObject}.
32883296
*/
3297+
@Nullable
32893298
public JSONObject getJSONObject(String key) {
32903299
synchronized (mutex) {
32913300
checkGetAccess(key);
@@ -3373,6 +3382,7 @@ public boolean getBoolean(String key) {
33733382
* The key to access the value for.
33743383
* @return {@code null} if there is no such key or if it is not a {@link Date}.
33753384
*/
3385+
@Nullable
33763386
public Date getDate(String key) {
33773387
synchronized (mutex) {
33783388
checkGetAccess(key);
@@ -3394,6 +3404,7 @@ public Date getDate(String key) {
33943404
* The key to access the value for.
33953405
* @return {@code null} if there is no such key or if it is not a {@code ParseObject}.
33963406
*/
3407+
@Nullable
33973408
public ParseObject getParseObject(String key) {
33983409
Object value = get(key);
33993410
if (!(value instanceof ParseObject)) {
@@ -3412,6 +3423,7 @@ public ParseObject getParseObject(String key) {
34123423
* The key to access the value for.
34133424
* @return {@code null} if there is no such key or if the value is not a {@link ParseUser}.
34143425
*/
3426+
@Nullable
34153427
public ParseUser getParseUser(String key) {
34163428
Object value = get(key);
34173429
if (!(value instanceof ParseUser)) {
@@ -3429,6 +3441,7 @@ public ParseUser getParseUser(String key) {
34293441
* The key to access the value for.
34303442
* @return {@code null} if there is no such key or if it is not a {@link ParseFile}.
34313443
*/
3444+
@Nullable
34323445
public ParseFile getParseFile(String key) {
34333446
Object value = get(key);
34343447
if (!(value instanceof ParseFile)) {
@@ -3444,6 +3457,7 @@ public ParseFile getParseFile(String key) {
34443457
* The key to access the value for
34453458
* @return {@code null} if there is no such key or if it is not a {@link ParseGeoPoint}.
34463459
*/
3460+
@Nullable
34473461
public ParseGeoPoint getParseGeoPoint(String key) {
34483462
synchronized (mutex) {
34493463
checkGetAccess(key);
@@ -3462,6 +3476,7 @@ public ParseGeoPoint getParseGeoPoint(String key) {
34623476
* The key to access the value for
34633477
* @return {@code null} if there is no such key or if it is not a {@link ParsePolygon}.
34643478
*/
3479+
@Nullable
34653480
public ParsePolygon getParsePolygon(String key) {
34663481
synchronized (mutex) {
34673482
checkGetAccess(key);
@@ -3476,6 +3491,7 @@ public ParsePolygon getParsePolygon(String key) {
34763491
/**
34773492
* Access the {@link ParseACL} governing this object.
34783493
*/
3494+
@Nullable
34793495
public ParseACL getACL() {
34803496
return getACL(true);
34813497
}
@@ -3540,6 +3556,7 @@ public boolean isDataAvailable(String key) {
35403556
* @return the ParseRelation object if the relation already exists for the key or can be created
35413557
* for this key.
35423558
*/
3559+
@NonNull
35433560
public <T extends ParseObject> ParseRelation<T> getRelation(String key) {
35443561
synchronized (mutex) {
35453562
// All the sanity checking is done when add or remove is called on the relation.
@@ -3573,6 +3590,7 @@ public <T extends ParseObject> ParseRelation<T> getRelation(String key) {
35733590
* The key to access the value for.
35743591
* @return {@code null} if there is no such key.
35753592
*/
3593+
@Nullable
35763594
public Object get(String key) {
35773595
synchronized (mutex) {
35783596
if (key.equals(KEY_ACL)) {

0 commit comments

Comments
 (0)