Skip to content

Commit 247cc9a

Browse files
committed
Merge pull request #335 from ParsePlatform/nlutsenko.generic.object
Add ObjC generics support to collections in PFObject public header.
2 parents 48e923c + 959b5a0 commit 247cc9a

File tree

1 file changed

+37
-35
lines changed

1 file changed

+37
-35
lines changed

Parse/PFObject.h

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
7575
7676
@returns A PFObject with the given class name and set with the given data.
7777
*/
78-
+ (instancetype)objectWithClassName:(NSString *)className dictionary:(PF_NULLABLE NSDictionary *)dictionary;
78+
+ (instancetype)objectWithClassName:(NSString *)className dictionary:(PF_NULLABLE NSDictionary PF_GENERIC(NSString *, id)*)dictionary;
7979

8080
/*!
8181
@abstract Creates a reference to an existing PFObject for use in creating associations between PFObjects.
@@ -125,7 +125,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
125125
@discussion This does not include `createdAt`, `updatedAt`, `authData`, or `objectId`.
126126
It does include things like username and ACL.
127127
*/
128-
- (NSArray *)allKeys;
128+
- (NSArray PF_GENERIC(NSString *)*)allKeys;
129129

130130
///--------------------------------------
131131
/// @name Accessors
@@ -387,7 +387,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
387387
388388
@returns Returns whether the save succeeded.
389389
*/
390-
+ (BOOL)saveAll:(PF_NULLABLE NSArray *)objects PF_SWIFT_UNAVAILABLE;
390+
+ (BOOL)saveAll:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects PF_SWIFT_UNAVAILABLE;
391391

392392
/*!
393393
@abstract Saves a collection of objects *synchronously* all at once and sets an error if necessary.
@@ -397,7 +397,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
397397
398398
@returns Returns whether the save succeeded.
399399
*/
400-
+ (BOOL)saveAll:(PF_NULLABLE NSArray *)objects error:(NSError **)error;
400+
+ (BOOL)saveAll:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects error:(NSError **)error;
401401

402402
/*!
403403
@abstract Saves a collection of objects all at once *asynchronously*.
@@ -406,7 +406,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
406406
407407
@returns The task that encapsulates the work being done.
408408
*/
409-
+ (BFTask PF_GENERIC(NSNumber *)*)saveAllInBackground:(PF_NULLABLE NSArray *)objects;
409+
+ (BFTask PF_GENERIC(NSNumber *)*)saveAllInBackground:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects;
410410

411411
/*!
412412
@abstract Saves a collection of objects all at once `asynchronously` and executes the block when done.
@@ -415,7 +415,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
415415
@param block The block to execute.
416416
It should have the following argument signature: `^(BOOL succeeded, NSError *error)`.
417417
*/
418-
+ (void)saveAllInBackground:(PF_NULLABLE NSArray *)objects
418+
+ (void)saveAllInBackground:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects
419419
block:(PF_NULLABLE PFBooleanResultBlock)block;
420420

421421
/*
@@ -428,7 +428,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
428428
`error` will be `nil` on success and set if there was an error.
429429
`[result boolValue]` will tell you whether the call succeeded or not.
430430
*/
431-
+ (void)saveAllInBackground:(PF_NULLABLE NSArray *)objects
431+
+ (void)saveAllInBackground:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects
432432
target:(PF_NULLABLE_S id)target
433433
selector:(PF_NULLABLE_S SEL)selector;
434434

@@ -443,7 +443,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
443443
444444
@returns Returns whether the delete succeeded.
445445
*/
446-
+ (BOOL)deleteAll:(PF_NULLABLE NSArray *)objects PF_SWIFT_UNAVAILABLE;
446+
+ (BOOL)deleteAll:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects PF_SWIFT_UNAVAILABLE;
447447

448448
/*!
449449
@abstract *Synchronously* deletes a collection of objects all at once and sets an error if necessary.
@@ -453,14 +453,14 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
453453
454454
@returns Returns whether the delete succeeded.
455455
*/
456-
+ (BOOL)deleteAll:(PF_NULLABLE NSArray *)objects error:(NSError **)error;
456+
+ (BOOL)deleteAll:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects error:(NSError **)error;
457457

458458
/*!
459459
@abstract Deletes a collection of objects all at once asynchronously.
460460
@param objects The array of objects to delete.
461461
@returns The task that encapsulates the work being done.
462462
*/
463-
+ (BFTask PF_GENERIC(NSNumber *)*)deleteAllInBackground:(PF_NULLABLE NSArray *)objects;
463+
+ (BFTask PF_GENERIC(NSNumber *)*)deleteAllInBackground:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects;
464464

465465
/*!
466466
@abstract Deletes a collection of objects all at once *asynchronously* and executes the block when done.
@@ -469,7 +469,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
469469
@param block The block to execute.
470470
It should have the following argument signature: `^(BOOL succeeded, NSError *error)`.
471471
*/
472-
+ (void)deleteAllInBackground:(PF_NULLABLE NSArray *)objects
472+
+ (void)deleteAllInBackground:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects
473473
block:(PF_NULLABLE PFBooleanResultBlock)block;
474474

475475
/*
@@ -482,7 +482,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
482482
`error` will be `nil` on success and set if there was an error.
483483
`[result boolValue]` will tell you whether the call succeeded or not.
484484
*/
485-
+ (void)deleteAllInBackground:(PF_NULLABLE NSArray *)objects
485+
+ (void)deleteAllInBackground:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects
486486
target:(PF_NULLABLE_S id)target
487487
selector:(PF_NULLABLE_S SEL)selector;
488488

@@ -626,7 +626,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
626626
627627
@param objects The list of objects to fetch.
628628
*/
629-
+ (PF_NULLABLE NSArray *)fetchAll:(PF_NULLABLE NSArray *)objects PF_SWIFT_UNAVAILABLE;
629+
+ (PF_NULLABLE NSArray PF_GENERIC(__kindof PFObject *)*)fetchAll:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects PF_SWIFT_UNAVAILABLE;
630630

631631
/*!
632632
@abstract *Synchronously* fetches all of the `PFObject` objects with the current data from the server
@@ -635,13 +635,14 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
635635
@param objects The list of objects to fetch.
636636
@param error Pointer to an `NSError` that will be set if necessary.
637637
*/
638-
+ (PF_NULLABLE NSArray *)fetchAll:(PF_NULLABLE NSArray *)objects error:(NSError **)error;
638+
+ (PF_NULLABLE NSArray PF_GENERIC(__kindof PFObject *)*)fetchAll:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects
639+
error:(NSError **)error;
639640

640641
/*!
641642
@abstract *Synchronously* fetches all of the `PFObject` objects with the current data from the server.
642643
@param objects The list of objects to fetch.
643644
*/
644-
+ (PF_NULLABLE NSArray *)fetchAllIfNeeded:(PF_NULLABLE NSArray *)objects PF_SWIFT_UNAVAILABLE;
645+
+ (PF_NULLABLE NSArray PF_GENERIC(__kindof PFObject *)*)fetchAllIfNeeded:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects PF_SWIFT_UNAVAILABLE;
645646

646647
/*!
647648
@abstract *Synchronously* fetches all of the `PFObject` objects with the current data from the server
@@ -650,7 +651,8 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
650651
@param objects The list of objects to fetch.
651652
@param error Pointer to an `NSError` that will be set if necessary.
652653
*/
653-
+ (PF_NULLABLE NSArray *)fetchAllIfNeeded:(PF_NULLABLE NSArray *)objects error:(NSError **)error;
654+
+ (PF_NULLABLE NSArray PF_GENERIC(__kindof PFObject *)*)fetchAllIfNeeded:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects
655+
error:(NSError **)error;
654656

655657
/*!
656658
@abstract Fetches all of the `PFObject` objects with the current data from the server *asynchronously*.
@@ -669,7 +671,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
669671
@param block The block to execute.
670672
It should have the following argument signature: `^(NSArray *objects, NSError *error)`.
671673
*/
672-
+ (void)fetchAllInBackground:(PF_NULLABLE NSArray *)objects
674+
+ (void)fetchAllInBackground:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects
673675
block:(PF_NULLABLE PFArrayResultBlock)block;
674676

675677
/*
@@ -683,7 +685,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
683685
`error` will be `nil` on success and set if there was an error.
684686
`fetchedObjects` will the array of `PFObject` objects that were fetched.
685687
*/
686-
+ (void)fetchAllInBackground:(PF_NULLABLE NSArray *)objects
688+
+ (void)fetchAllInBackground:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects
687689
target:(PF_NULLABLE_S id)target
688690
selector:(PF_NULLABLE_S SEL)selector;
689691

@@ -704,7 +706,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
704706
@param block The block to execute.
705707
It should have the following argument signature: `^(NSArray *objects, NSError *error)`.
706708
*/
707-
+ (void)fetchAllIfNeededInBackground:(PF_NULLABLE NSArray *)objects
709+
+ (void)fetchAllIfNeededInBackground:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects
708710
block:(PF_NULLABLE PFArrayResultBlock)block;
709711

710712
/*
@@ -718,7 +720,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
718720
`error` will be `nil` on success and set if there was an error.
719721
`fetchedObjects` will the array of `PFObject` objects that were fetched.
720722
*/
721-
+ (void)fetchAllIfNeededInBackground:(PF_NULLABLE NSArray *)objects
723+
+ (void)fetchAllIfNeededInBackground:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects
722724
target:(PF_NULLABLE_S id)target
723725
selector:(PF_NULLABLE_S SEL)selector;
724726

@@ -1004,7 +1006,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
10041006
@see unpinAll:
10051007
@see PFObjectDefaultPin
10061008
*/
1007-
+ (BOOL)pinAll:(PF_NULLABLE NSArray *)objects PF_SWIFT_UNAVAILABLE;
1009+
+ (BOOL)pinAll:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects PF_SWIFT_UNAVAILABLE;
10081010

10091011
/*!
10101012
@abstract *Synchronously* stores the objects and every object they point to in the local datastore, recursively,
@@ -1023,7 +1025,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
10231025
@see unpinAll:error:
10241026
@see PFObjectDefaultPin
10251027
*/
1026-
+ (BOOL)pinAll:(PF_NULLABLE NSArray *)objects error:(NSError **)error;
1028+
+ (BOOL)pinAll:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects error:(NSError **)error;
10271029

10281030
/*!
10291031
@abstract *Synchronously* stores the objects and every object they point to in the local datastore, recursively.
@@ -1040,7 +1042,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
10401042
10411043
@see unpinAll:withName:
10421044
*/
1043-
+ (BOOL)pinAll:(PF_NULLABLE NSArray *)objects withName:(NSString *)name PF_SWIFT_UNAVAILABLE;
1045+
+ (BOOL)pinAll:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects withName:(NSString *)name PF_SWIFT_UNAVAILABLE;
10441046

10451047
/*!
10461048
@abstract *Synchronously* stores the objects and every object they point to in the local datastore, recursively.
@@ -1058,7 +1060,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
10581060
10591061
@see unpinAll:withName:error:
10601062
*/
1061-
+ (BOOL)pinAll:(PF_NULLABLE NSArray *)objects
1063+
+ (BOOL)pinAll:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects
10621064
withName:(NSString *)name
10631065
error:(NSError **)error;
10641066

@@ -1096,7 +1098,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
10961098
@see unpinAllInBackground:block:
10971099
@see PFObjectDefaultPin
10981100
*/
1099-
+ (void)pinAllInBackground:(PF_NULLABLE NSArray *)objects block:(PF_NULLABLE PFBooleanResultBlock)block;
1101+
+ (void)pinAllInBackground:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects block:(PF_NULLABLE PFBooleanResultBlock)block;
11001102

11011103
/*!
11021104
@abstract *Asynchronously* stores the objects and every object they point to in the local datastore, recursively.
@@ -1113,7 +1115,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
11131115
11141116
@see unpinAllInBackground:withName:
11151117
*/
1116-
+ (BFTask PF_GENERIC(NSNumber *)*)pinAllInBackground:(PF_NULLABLE NSArray *)objects withName:(NSString *)name;
1118+
+ (BFTask PF_GENERIC(NSNumber *)*)pinAllInBackground:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects withName:(NSString *)name;
11171119

11181120
/*!
11191121
@abstract *Asynchronously* stores the objects and every object they point to in the local datastore, recursively.
@@ -1130,7 +1132,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
11301132
11311133
@see unpinAllInBackground:withName:block:
11321134
*/
1133-
+ (void)pinAllInBackground:(PF_NULLABLE NSArray *)objects
1135+
+ (void)pinAllInBackground:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects
11341136
withName:(NSString *)name
11351137
block:(PF_NULLABLE PFBooleanResultBlock)block;
11361138

@@ -1327,7 +1329,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
13271329
@see pinAll:
13281330
@see PFObjectDefaultPin
13291331
*/
1330-
+ (BOOL)unpinAll:(PF_NULLABLE NSArray *)objects PF_SWIFT_UNAVAILABLE;
1332+
+ (BOOL)unpinAll:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects PF_SWIFT_UNAVAILABLE;
13311333

13321334
/*!
13331335
@abstract *Synchronously* removes the objects and every object they point to in the local datastore, recursively,
@@ -1341,7 +1343,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
13411343
@see pinAll:error:
13421344
@see PFObjectDefaultPin
13431345
*/
1344-
+ (BOOL)unpinAll:(PF_NULLABLE NSArray *)objects error:(NSError **)error;
1346+
+ (BOOL)unpinAll:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects error:(NSError **)error;
13451347

13461348
/*!
13471349
@abstract *Synchronously* removes the objects and every object they point to in the local datastore, recursively.
@@ -1353,7 +1355,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
13531355
13541356
@see pinAll:withName:
13551357
*/
1356-
+ (BOOL)unpinAll:(PF_NULLABLE NSArray *)objects withName:(NSString *)name PF_SWIFT_UNAVAILABLE;
1358+
+ (BOOL)unpinAll:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects withName:(NSString *)name PF_SWIFT_UNAVAILABLE;
13571359

13581360
/*!
13591361
@abstract *Synchronously* removes the objects and every object they point to in the local datastore, recursively.
@@ -1366,7 +1368,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
13661368
13671369
@see pinAll:withName:error:
13681370
*/
1369-
+ (BOOL)unpinAll:(PF_NULLABLE NSArray *)objects
1371+
+ (BOOL)unpinAll:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects
13701372
withName:(NSString *)name
13711373
error:(NSError **)error;
13721374

@@ -1381,7 +1383,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
13811383
@see pinAllInBackground:
13821384
@see PFObjectDefaultPin
13831385
*/
1384-
+ (BFTask PF_GENERIC(NSNumber *)*)unpinAllInBackground:(PF_NULLABLE NSArray *)objects;
1386+
+ (BFTask PF_GENERIC(NSNumber *)*)unpinAllInBackground:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects;
13851387

13861388
/*!
13871389
@abstract *Asynchronously* removes the objects and every object they point to in the local datastore, recursively,
@@ -1394,7 +1396,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
13941396
@see pinAllInBackground:block:
13951397
@see PFObjectDefaultPin
13961398
*/
1397-
+ (void)unpinAllInBackground:(PF_NULLABLE NSArray *)objects block:(PF_NULLABLE PFBooleanResultBlock)block;
1399+
+ (void)unpinAllInBackground:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects block:(PF_NULLABLE PFBooleanResultBlock)block;
13981400

13991401
/*!
14001402
@abstract *Asynchronously* removes the objects and every object they point to in the local datastore, recursively.
@@ -1406,7 +1408,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
14061408
14071409
@see pinAllInBackground:withName:
14081410
*/
1409-
+ (BFTask PF_GENERIC(NSNumber *)*)unpinAllInBackground:(PF_NULLABLE NSArray *)objects withName:(NSString *)name;
1411+
+ (BFTask PF_GENERIC(NSNumber *)*)unpinAllInBackground:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects withName:(NSString *)name;
14101412

14111413
/*!
14121414
@abstract *Asynchronously* removes the objects and every object they point to in the local datastore, recursively.
@@ -1418,7 +1420,7 @@ NS_REQUIRES_PROPERTY_DEFINITIONS
14181420
14191421
@see pinAllInBackground:withName:block:
14201422
*/
1421-
+ (void)unpinAllInBackground:(PF_NULLABLE NSArray *)objects
1423+
+ (void)unpinAllInBackground:(PF_NULLABLE NSArray PF_GENERIC(PFObject *)*)objects
14221424
withName:(NSString *)name
14231425
block:(PF_NULLABLE PFBooleanResultBlock)block;
14241426

0 commit comments

Comments
 (0)