/** * @since Available in iOS 3.0 and later. */ public static NSObject observeDidSave(NSManagedObject object, final VoidBlock2<NSManagedObject, NSManagedObjectContextNotification> block) { return NSNotificationCenter.getDefaultCenter().addObserver(DidSaveNotification(), object, NSOperationQueue.getMainQueue(), new VoidBlock1<NSNotification>() { @Override public void invoke(NSNotification a) { NSDictionary<?, ?> userInfo = a.getUserInfo(); NSManagedObjectContextNotification data = null; if (userInfo != null) { data = new NSManagedObjectContextNotification(userInfo); } block.invoke((NSManagedObject)a.getObject(), data); } }); } /**
/** * @since Available in iOS 3.0 and later. */ public static NSObject observeObjectsDidChange(NSManagedObject object, final VoidBlock3<NSManagedObject, NSManagedObjectContextNotification, NSNotification> block) { return NSNotificationCenter.getDefaultCenter().addObserver(ObjectsDidChangeNotification(), object, NSOperationQueue.getMainQueue(), new VoidBlock1<NSNotification>() { @Override public void invoke(NSNotification a) { NSDictionary<?, ?> userInfo = a.getUserInfo(); NSManagedObjectContextNotification data = null; if (userInfo != null) { data = new NSManagedObjectContextNotification(userInfo); } block.invoke((NSManagedObject)a.getObject(), data, a); } }); }
/** * @since Available in iOS 3.0 and later. */ public static NSObject observeWillSave(NSManagedObject object, final VoidBlock1<NSManagedObject> block) { return NSNotificationCenter.getDefaultCenter().addObserver(WillSaveNotification(), object, NSOperationQueue.getMainQueue(), new VoidBlock1<NSNotification>() { @Override public void invoke(NSNotification a) { block.invoke((NSManagedObject)a.getObject()); } }); } /**
/** * @since Available in iOS 5.0 and later. */ public NSManagedObjectContext(NSManagedObjectContextConcurrencyType ct) { super((SkipInit) null); initObject(init(ct)); } public NSManagedObjectContext(NSCoder aDecoder) { super((SkipInit) null); initObject(init(aDecoder)); }
/** * @since Available in iOS 3.0 and later. */ public @MachineSizedUInt long getCountForFetchRequest(NSFetchRequest request) throws NSErrorException { NSError.NSErrorPtr ptr = new NSError.NSErrorPtr(); long result = getCountForFetchRequest(request, ptr); if (ptr.get() != null) { throw new NSErrorException(ptr.get()); } return result; } /**
@Method(selector = "observeValueForKeyPath:ofObject:change:context:") private void observeValueForKeyPath(String keyPath, NSObject object, NSKeyValueChangeInfo change, VoidPtr context) { observeValue(keyPath, object, change); } /*<methods>*/
/** * @since Available in iOS 3.0 and later. */ public NSManagedObject getExistingObjectWithID(NSManagedObjectID objectID) throws NSErrorException { NSError.NSErrorPtr ptr = new NSError.NSErrorPtr(); NSManagedObject result = getExistingObjectWithID(objectID, ptr); if (ptr.get() != null) { throw new NSErrorException(ptr.get()); } return result; } /**
/** * @since Available in iOS 8.0 and later. */ public NSPersistentStoreResult executeRequest(NSPersistentStoreRequest request) throws NSErrorException { NSError.NSErrorPtr ptr = new NSError.NSErrorPtr(); NSPersistentStoreResult result = executeRequest(request, ptr); if (ptr.get() != null) { throw new NSErrorException(ptr.get()); } return result; } /**
@Method(selector = "executeFetchRequest:error:") private native NSArray<NSManagedObject> executeFetchRequest(NSFetchRequest request, NSError.NSErrorPtr error); /**
public NSManagedObjectContext(NSCoder aDecoder) { super((SkipInit) null); initObject(init(aDecoder)); } /*</constructors>*/
/** * @since Available in iOS 3.0 and later. */ public @MachineSizedUInt long getCountForFetchRequest(NSFetchRequest request) throws NSErrorException { NSError.NSErrorPtr ptr = new NSError.NSErrorPtr(); long result = getCountForFetchRequest(request, ptr); if (ptr.get() != null) { throw new NSErrorException(ptr.get()); } return result; } /**
@Method(selector = "observeValueForKeyPath:ofObject:change:context:") private void observeValueForKeyPath(String keyPath, NSObject object, NSKeyValueChangeInfo change, VoidPtr context) { observeValue(keyPath, object, change); } /*<methods>*/
/** * @since Available in iOS 3.0 and later. */ public NSManagedObject getExistingObjectWithID(NSManagedObjectID objectID) throws NSErrorException { NSError.NSErrorPtr ptr = new NSError.NSErrorPtr(); NSManagedObject result = getExistingObjectWithID(objectID, ptr); if (ptr.get() != null) { throw new NSErrorException(ptr.get()); } return result; } /**
/** * @since Available in iOS 8.0 and later. */ public NSPersistentStoreResult executeRequest(NSPersistentStoreRequest request) throws NSErrorException { NSError.NSErrorPtr ptr = new NSError.NSErrorPtr(); NSPersistentStoreResult result = executeRequest(request, ptr); if (ptr.get() != null) { throw new NSErrorException(ptr.get()); } return result; } /**
@Method(selector = "executeFetchRequest:error:") private native NSArray<NSManagedObject> executeFetchRequest(NSFetchRequest request, NSError.NSErrorPtr error); /**
/** * @since Available in iOS 5.0 and later. */ @Method(selector = "initWithConcurrencyType:") public NSManagedObjectContext(NSManagedObjectContextConcurrencyType ct) { super((SkipInit) null); initObject(init(ct)); } @Method(selector = "initWithCoder:")
/** * @since Available in iOS 3.0 and later. */ public @MachineSizedUInt long getCountForFetchRequest(NSFetchRequest request) throws NSErrorException { NSError.NSErrorPtr ptr = new NSError.NSErrorPtr(); long result = getCountForFetchRequest(request, ptr); if (ptr.get() != null) { throw new NSErrorException(ptr.get()); } return result; } /**
/** * @since Available in iOS 3.0 and later. */ public static NSObject observeWillSave(NSManagedObject object, final VoidBlock1<NSManagedObject> block) { return NSNotificationCenter.getDefaultCenter().addObserver(WillSaveNotification(), object, NSOperationQueue.getMainQueue(), new VoidBlock1<NSNotification>() { @Override public void invoke(NSNotification a) { block.invoke((NSManagedObject)a.getObject()); } }); } /**
@Method(selector = "observeValueForKeyPath:ofObject:change:context:") private void observeValueForKeyPath(String keyPath, NSObject object, NSKeyValueChangeInfo change, VoidPtr context) { observeValue(keyPath, object, change); } /*<methods>*/
/** * @since Available in iOS 3.0 and later. */ public NSManagedObject getExistingObjectWithID(NSManagedObjectID objectID) throws NSErrorException { NSError.NSErrorPtr ptr = new NSError.NSErrorPtr(); NSManagedObject result = getExistingObjectWithID(objectID, ptr); if (ptr.get() != null) { throw new NSErrorException(ptr.get()); } return result; } /**