Class NSManagedObjectContext

    • Constructor Detail

      • NSManagedObjectContext

        protected NSManagedObjectContext​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static java.lang.Object allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(java.lang.Object aTarget,
                                                                                 org.moe.natj.objc.SEL aSelector,
                                                                                 java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        public static org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(java.lang.String key)
      • mergeChangesFromRemoteContextSaveIntoContexts

        public static void mergeChangesFromRemoteContextSaveIntoContexts​(NSDictionary<?,​?> changeNotificationData,
                                                                         NSArray<? extends NSManagedObjectContext> contexts)
        Similar to mergeChangesFromContextDidSaveNotification, this method handles changes from potentially other processes or serialized state. It more efficiently merges changes into multiple contexts, as well as nested context. The keys in the dictionary should be one those from an NSManagedObjectContextObjectsDidChangeNotification: NSInsertedObjectsKey, NSUpdatedObjectsKey, etc. the values should be an NSArray of either NSManagedObjectID or NSURL objects conforming to valid results from -URIRepresentation
      • new_objc

        @Deprecated
        public static java.lang.Object new_objc()
        Deprecated.
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • assignObjectToPersistentStore

        public void assignObjectToPersistentStore​(java.lang.Object object,
                                                  NSPersistentStore store)
        specifies the store a newly inserted object will be saved in. Unnecessary unless there are multiple writable persistent stores added to the NSPersistentStoreCoordinator which support this object's entity.
      • automaticallyMergesChangesFromParent

        public boolean automaticallyMergesChangesFromParent()
        Whether the context automatically merges changes saved to its coordinator or parent context. Setting this property to YES when the context is pinned to a non-current query generation is not supported.
      • concurrencyType

        public long concurrencyType()
      • countForFetchRequestError

        public long countForFetchRequestError​(NSFetchRequest<?> request,
                                              org.moe.natj.general.ptr.Ptr<NSError> error)
        returns the number of objects a fetch request would have returned if it had been passed to -executeFetchRequest:error:. If an error occurred during the processing of the request, this method will return NSNotFound.
      • detectConflictsForObject

        public void detectConflictsForObject​(NSManagedObject object)
        marks an object for conflict detection, which means that the save fails if the object has been altered in the persistent store by another application. This allows optimistic locking for unchanged objects. Conflict detection is always performed on changed or deleted objects.
      • executeFetchRequestError

        public NSArray<?> executeFetchRequestError​(NSFetchRequest<?> request,
                                                   org.moe.natj.general.ptr.Ptr<NSError> error)
        method to fetch objects from the persistent stores into the context (fetch request defines the entity and predicate as well as a sort order for the objects); context will match the results from persistent stores with current changes in the context (so inserted objects are returned even if they are not persisted yet); to fetch a single object with an ID if it is not guaranteed to exist and thus -objectWithObjectID: cannot be used, one would create a predicate like [NSComparisonPredicate predicateWithLeftExpression:[NSExpression expressionForKeyPath:@"objectID"] rightExpression:[NSExpression expressionForConstantValue:] modifier:NSDirectPredicateModifier type:NSEqualToPredicateOperatorType options:0]
        • executeRequestError

          public NSPersistentStoreResult executeRequestError​(NSPersistentStoreRequest request,
                                                             org.moe.natj.general.ptr.Ptr<NSError> error)
          Method to pass a request to the store without affecting the contents of the managed object context. Will return an NSPersistentStoreResult which may contain additional information about the result of the action (ie a batch update result may contain the object IDs of the objects that were modified during the update). A request may succeed in some stores and fail in others. In this case, the error will contain information about each individual store failure. Will always reject NSSaveChangesRequests.
        • existingObjectWithIDError

          public NSManagedObject existingObjectWithIDError​(NSManagedObjectID objectID,
                                                           org.moe.natj.general.ptr.Ptr<NSError> error)
          returns the object for the specified ID if it is already registered in the context, or faults the object into the context. It might perform I/O if the data is uncached. If the object cannot be fetched, or does not exist, or cannot be faulted, it returns nil. Unlike -objectWithID: it never returns a fault.
        • hasChanges

          public boolean hasChanges()
        • lock

          @Deprecated
          public void lock()
          Deprecated.
          Specified by:
          lock in interface NSLocking
        • mergeChangesFromContextDidSaveNotification

          public void mergeChangesFromContextDidSaveNotification​(NSNotification notification)
          Merges the changes specified in notification object received from another context's NSManagedObjectContextDidSaveNotification into the receiver. This method will refresh any objects which have been updated in the other context, fault in any newly inserted objects, and invoke deleteObject: on those which have been deleted. The developer is only responsible for the thread safety of the receiver.
        • mergePolicy

          public java.lang.Object mergePolicy()
          default: NSErrorMergePolicy
        • name

          public java.lang.String name()
          custom label for a context. NSPrivateQueueConcurrencyType contexts will set the label on their queue
        • objectRegisteredForID

          public NSManagedObject objectRegisteredForID​(NSManagedObjectID objectID)
          returns the object for the specified ID if it is registered in the context already or nil. It never performs I/O.
        • objectWithID

          public NSManagedObject objectWithID​(NSManagedObjectID objectID)
          returns the object for the specified ID if it is already registered, otherwise it creates a fault corresponding to that objectID. It never returns nil, and never performs I/O. The object specified by objectID is assumed to exist, and if that assumption is wrong the fault may throw an exception when used.
        • observeValueForKeyPathOfObjectChangeContext

          public void observeValueForKeyPathOfObjectChangeContext​(java.lang.String keyPath,
                                                                  java.lang.Object object,
                                                                  NSDictionary<java.lang.String,​?> change,
                                                                  org.moe.natj.general.ptr.VoidPtr context)
          key-value observation
          Overrides:
          observeValueForKeyPathOfObjectChangeContext in class NSObject
        • obtainPermanentIDsForObjectsError

          public boolean obtainPermanentIDsForObjectsError​(NSArray<? extends NSManagedObject> objects,
                                                           org.moe.natj.general.ptr.Ptr<NSError> error)
          Converts the object IDs of the specified objects to permanent IDs. This implementation will convert the object ID of each managed object in the specified array to a permanent ID. Any object in the target array with a permanent ID will be ignored; additionally, any managed object in the array not already assigned to a store will be assigned, based on the same rules Core Data uses for assignment during a save operation (first writable store supporting the entity, and appropriate for the instance and its related items.) Although the object will have a permanent ID, it will still respond positively to -isInserted until it is saved. If an error is encountered obtaining an identifier, the return value will be NO.
        • performBlock

          public void performBlock​(NSManagedObjectContext.Block_performBlock block)
          asynchronously performs the block on the context's queue. Encapsulates an autorelease pool and a call to processPendingChanges
        • persistentStoreCoordinator

          public NSPersistentStoreCoordinator persistentStoreCoordinator()
          coordinator which provides model and handles persistency (multiple contexts can share a coordinator)
        • processPendingChanges

          public void processPendingChanges()
          usually contexts process changes to the object graph coalesced at the end of the event - this method triggers it explicitly
        • propagatesDeletesAtEndOfEvent

          public boolean propagatesDeletesAtEndOfEvent()
          The default is YES.
        • queryGenerationToken

          public NSQueryGenerationToken queryGenerationToken()
          Return the query generation currently in use by this context. Will be one of the following: - nil, default value => this context is not using generational querying - an opaque token => specifies the generation of data this context is vending All child contexts will return nil.
        • redo

          public void redo()
        • refreshAllObjects

          public void refreshAllObjects()
          calls -refreshObject:mergeChanges: on all currently registered objects with this context. It handles dirtied objects and clearing the context reference queue
        • refreshObjectMergeChanges

          public void refreshObjectMergeChanges​(NSManagedObject object,
                                                boolean flag)
          if flag is YES, merges an object with the state of the object available in the persistent store coordinator; if flag is NO, simply refaults an object without merging (which also causes other related managed objects to be released, so you can use this method to trim the portion of your object graph you want to hold in memory)
        • reset

          public void reset()
        • retainsRegisteredObjects

          public boolean retainsRegisteredObjects()
          The default is NO.
        • rollback

          public void rollback()
        • save

          public boolean save​(org.moe.natj.general.ptr.Ptr<NSError> error)
        • setAutomaticallyMergesChangesFromParent

          public void setAutomaticallyMergesChangesFromParent​(boolean value)
          Whether the context automatically merges changes saved to its coordinator or parent context. Setting this property to YES when the context is pinned to a non-current query generation is not supported.
        • setMergePolicy

          public void setMergePolicy​(java.lang.Object value)
          default: NSErrorMergePolicy
        • setName

          public void setName​(java.lang.String value)
          custom label for a context. NSPrivateQueueConcurrencyType contexts will set the label on their queue
        • setPersistentStoreCoordinator

          public void setPersistentStoreCoordinator​(NSPersistentStoreCoordinator value)
          coordinator which provides model and handles persistency (multiple contexts can share a coordinator)
        • setPropagatesDeletesAtEndOfEvent

          public void setPropagatesDeletesAtEndOfEvent​(boolean value)
          The default is YES.
        • setQueryGenerationFromTokenError

          public boolean setQueryGenerationFromTokenError​(NSQueryGenerationToken generation,
                                                          org.moe.natj.general.ptr.Ptr<NSError> error)
          Set the query generation this context should use. Must be one of the following values: - nil => this context will not use generational querying - the value returned by +[NSQueryGenerationToken currentQueryGenerationToken] => this context will pin itself to the generation of the database when it first loads data - the result of calling -[NSManagedObjectContext queryGenerationToken] on another managed object context => this context will be set to whatever query generation the original context is currently using; Query generations are for fetched data only; they are not used during saving. If a pinned context saves, its query generation will be updated after the save. Executing a NSBatchUpdateRequest or NSBatchDeleteRequest will not cause the query generation to advance, since these do not otherwise consider or affect the managed object context's content. All nested contexts will defer to their parent context’s data. It is a programmer error to try to set the queryGenerationToken on a child context. Query generations are tracked across the union of stores. Additions to the persistent store coordinator's persistent stores will be ignored until the context's query generation is updated to include them. May partially fail if one or more stores being tracked by the token are removed from the persistent store coordinator.
        • setRetainsRegisteredObjects

          public void setRetainsRegisteredObjects​(boolean value)
          The default is NO.
        • setShouldDeleteInaccessibleFaults

          public void setShouldDeleteInaccessibleFaults​(boolean value)
          set the rule to handle inaccessible faults. If YES, then the managed object is marked deleted and all its properties, including scalars, nonnullable, and mandatory properties, will be nil or zero’d out. If NO, the context will throw an exception. Managed objects that are inaccessible because their context is nil due to memory management issues will throw an exception regardless.
        • setStalenessInterval

          public void setStalenessInterval​(double value)
          a negative value is considered infinite. The default is infinite staleness.
        • setUndoManager

          public void setUndoManager​(NSUndoManager value)
        • shouldDeleteInaccessibleFaults

          public boolean shouldDeleteInaccessibleFaults()
          set the rule to handle inaccessible faults. If YES, then the managed object is marked deleted and all its properties, including scalars, nonnullable, and mandatory properties, will be nil or zero’d out. If NO, the context will throw an exception. Managed objects that are inaccessible because their context is nil due to memory management issues will throw an exception regardless.
        • shouldHandleInaccessibleFaultForObjectIDTriggeredByProperty

          public boolean shouldHandleInaccessibleFaultForObjectIDTriggeredByProperty​(NSManagedObject fault,
                                                                                     NSManagedObjectID oid,
                                                                                     NSPropertyDescription property)
          this method will not be called from APIs which return an NSError like -existingObjectWithID:error: nor for managed objects with a nil context (e.g. the fault is inaccessible because the object or its context have been released) this method will not be called if Core Data determines there is an unambiguously correct action to recover. This might happen if a fault was tripped during delete propagation. In that case, the fault will simply be deleted. triggeringProperty may be nil when either all properties are involved, or Core Data is unable to determine the reason for firing the fault. the default implementation logs and then returns the value of -shouldDeleteInaccessibleFaults.
        • stalenessInterval

          public double stalenessInterval()
          a negative value is considered infinite. The default is infinite staleness.
        • tryLock

          @Deprecated
          public boolean tryLock()
          Deprecated.
        • undo

          public void undo()
        • unlock

          @Deprecated
          public void unlock()
          Deprecated.
          Specified by:
          unlock in interface NSLocking
        • setTransactionAuthor

          public void setTransactionAuthor​(java.lang.String value)
          Set the author for the context, this will be used as an identifier in the Persistent History Transactions (NSPersistentHistoryTransaction)
        • transactionAuthor

          public java.lang.String transactionAuthor()
          Set the author for the context, this will be used as an identifier in the Persistent History Transactions (NSPersistentHistoryTransaction)