/** * @since Available in iOS 3.0 and later. */ public static NSObject observeStoresDidChange(NSPersistentStoreCoordinator object, final VoidBlock2<NSPersistentStoreCoordinator, NSPersistentStoreCoordinatorChangeNotification> block) { return NSNotificationCenter.getDefaultCenter().addObserver(StoresDidChangeNotification(), object, NSOperationQueue.getMainQueue(), new VoidBlock1<NSNotification>() { @Override public void invoke(NSNotification a) { NSDictionary<?, ?> userInfo = a.getUserInfo(); NSPersistentStoreCoordinatorChangeNotification data = null; if (userInfo != null) { data = new NSPersistentStoreCoordinatorChangeNotification(userInfo); } block.invoke((NSPersistentStoreCoordinator)a.getObject(), data); } }); } /**
/** * @since Available in iOS 7.0 and later. */ public static NSObject observeStoresWillChange(NSPersistentStoreCoordinator object, final VoidBlock2<NSPersistentStoreCoordinator, NSPersistentStoreCoordinatorChangeNotification> block) { return NSNotificationCenter.getDefaultCenter().addObserver(StoresWillChangeNotification(), object, NSOperationQueue.getMainQueue(), new VoidBlock1<NSNotification>() { @Override public void invoke(NSNotification a) { NSDictionary<?, ?> userInfo = a.getUserInfo(); NSPersistentStoreCoordinatorChangeNotification data = null; if (userInfo != null) { data = new NSPersistentStoreCoordinatorChangeNotification(userInfo); } block.invoke((NSPersistentStoreCoordinator)a.getObject(), data); } }); } /**
/** * @since Available in iOS 3.0 and later. */ public static NSObject observeWillRemoveStore(NSPersistentStoreCoordinator object, final VoidBlock1<NSPersistentStoreCoordinator> block) { return NSNotificationCenter.getDefaultCenter().addObserver(WillRemoveStoreNotification(), object, NSOperationQueue.getMainQueue(), new VoidBlock1<NSNotification>() { @Override public void invoke(NSNotification a) { block.invoke((NSPersistentStoreCoordinator)a.getObject()); } }); } /**
public NSPersistentStoreCoordinator(NSManagedObjectModel model) { super((SkipInit) null); initObject(init(model)); } /*</constructors>*/
/** * * @param storeType * @param url * @return * @since Available in iOS 3.0 and later. * @throws NSErrorException */ public static NSPersistentStoreMetadata getMetadataForPersistentStoreType(NSPersistentStoreType storeType, NSURL url) throws NSErrorException { return getMetadataForPersistentStoreType(storeType.value().toString(), url); } /**
/** * * @param storeType * @param configuration * @param storeURL * @param options * @return * @throws NSErrorException */ public NSPersistentStore addPersistentStore(NSPersistentStoreType storeType, String configuration, NSURL storeURL, NSPersistentStoreOptions options) throws NSErrorException { return addPersistentStore(storeType.value().toString(), configuration, storeURL, options); } /**
/** * * @param store * @param URL * @param options * @param storeType * @return * @throws NSErrorException */ public NSPersistentStore migratePersistentStore(NSPersistentStore store, NSURL URL, NSPersistentStoreOptions options, NSPersistentStoreType storeType) throws NSErrorException { return migratePersistentStore(store, URL, options, storeType.value().toString()); } /**
/** * @since Available in iOS 9.0 and later. */ public boolean destroyPersistentStore(NSURL url, String storeType, NSPersistentStoreOptions options) throws NSErrorException { NSError.NSErrorPtr ptr = new NSError.NSErrorPtr(); boolean result = destroyPersistentStore(url, storeType, options, ptr); if (ptr.get() != null) { throw new NSErrorException(ptr.get()); } return result; } /**
/** * @since Available in iOS 5.0 and later. */ public NSObject executeRequest(NSPersistentStoreRequest request, NSManagedObjectContext context) throws NSErrorException { NSError.NSErrorPtr ptr = new NSError.NSErrorPtr(); NSObject result = executeRequest(request, context, ptr); if (ptr.get() != null) { throw new NSErrorException(ptr.get()); } return result; } /**
@Method(selector = "initWithManagedObjectModel:") public NSPersistentStoreCoordinator(NSManagedObjectModel model) { super((SkipInit) null); initObject(init(model)); } /*</constructors>*/
/** * @since Available in iOS 3.0 and later. * @deprecated Deprecated in iOS 9.0. */ @Deprecated public static NSPersistentStoreMetadata getMetadataForPersistentStoreType(String storeType, NSURL url) throws NSErrorException { NSError.NSErrorPtr ptr = new NSError.NSErrorPtr(); NSPersistentStoreMetadata result = getMetadataForPersistentStoreType(storeType, url, ptr); if (ptr.get() != null) { throw new NSErrorException(ptr.get()); } return result; } /**
@Method(selector = "addPersistentStoreWithType:configuration:URL:options:error:") private native NSPersistentStore addPersistentStore(String storeType, String configuration, NSURL storeURL, NSPersistentStoreOptions options, NSError.NSErrorPtr error); public boolean removePersistentStore(NSPersistentStore store) throws NSErrorException {
@Method(selector = "migratePersistentStore:toURL:options:withType:error:") private native NSPersistentStore migratePersistentStore(NSPersistentStore store, NSURL URL, NSPersistentStoreOptions options, String storeType, NSError.NSErrorPtr error); /**
/** * @since Available in iOS 9.0 and later. */ public boolean destroyPersistentStore(NSURL url, String storeType, NSPersistentStoreOptions options) throws NSErrorException { NSError.NSErrorPtr ptr = new NSError.NSErrorPtr(); boolean result = destroyPersistentStore(url, storeType, options, ptr); if (ptr.get() != null) { throw new NSErrorException(ptr.get()); } return result; } /**
/** * @since Available in iOS 5.0 and later. */ public NSObject executeRequest(NSPersistentStoreRequest request, NSManagedObjectContext context) throws NSErrorException { NSError.NSErrorPtr ptr = new NSError.NSErrorPtr(); NSObject result = executeRequest(request, context, ptr); if (ptr.get() != null) { throw new NSErrorException(ptr.get()); } return result; } /**
@Method(selector = "initWithManagedObjectModel:") public NSPersistentStoreCoordinator(NSManagedObjectModel model) { super((SkipInit) null); initObject(init(model)); } /*</constructors>*/
/** * @since Available in iOS 7.0 and later. */ public static NSPersistentStoreMetadata getMetadataForPersistentStoreType(String storeType, NSURL url, NSPersistentStoreOptions options) throws NSErrorException { NSError.NSErrorPtr ptr = new NSError.NSErrorPtr(); NSPersistentStoreMetadata result = getMetadataForPersistentStoreType(storeType, url, options, ptr); if (ptr.get() != null) { throw new NSErrorException(ptr.get()); } return result; } /**
/** * @since Available in iOS 5.0 and later. */ public static NSObject observeDidImportUbiquitousContentChanges(NSPersistentStoreCoordinator object, final VoidBlock2<NSPersistentStoreCoordinator, NSNotification> block) { return NSNotificationCenter.getDefaultCenter().addObserver(WillRemoveStoreNotification(), object, NSOperationQueue.getMainQueue(), new VoidBlock1<NSNotification>() { @Override public void invoke(NSNotification a) { block.invoke((NSPersistentStoreCoordinator)a.getObject(), a); } }); } }
/** * * @param storeType * @param configuration * @param storeURL * @param options * @return * @throws NSErrorException */ public NSPersistentStore addPersistentStore(NSPersistentStoreType storeType, String configuration, NSURL storeURL, NSPersistentStoreOptions options) throws NSErrorException { return addPersistentStore(storeType.value().toString(), configuration, storeURL, options); } /**
/** * * @param store * @param URL * @param options * @param storeType * @return * @throws NSErrorException */ public NSPersistentStore migratePersistentStore(NSPersistentStore store, NSURL URL, NSPersistentStoreOptions options, NSPersistentStoreType storeType) throws NSErrorException { return migratePersistentStore(store, URL, options, storeType.value().toString()); } /**