Package apple.coredata
Class NSManagedObject
- java.lang.Object
-
- org.moe.natj.general.NativeObject
-
- org.moe.natj.objc.ObjCObject
-
- apple.NSObject
-
- apple.coredata.NSManagedObject
-
- All Implemented Interfaces:
NSFetchRequestResult,NSObject
public class NSManagedObject extends NSObject implements NSFetchRequestResult
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class apple.NSObject
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedNSManagedObject(org.moe.natj.general.Pointer peer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanaccessInstanceVariablesDirectly()static NSManagedObjectalloc()static java.lang.ObjectallocWithZone(org.moe.natj.general.ptr.VoidPtr zone)static booleanautomaticallyNotifiesObserversForKey(java.lang.String key)voidawakeFromFetch()invoked after a fetch or after unfaulting (commonly used for computing derived values from the persisted properties)voidawakeFromInsert()invoked after an insert (commonly used for initializing special default/initial settings)voidawakeFromSnapshotEvents(long flags)Callback for undo, redo, and other multi-property state resetsstatic voidcancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)static voidcancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget, org.moe.natj.objc.SEL aSelector, java.lang.Object anArgument)NSDictionary<java.lang.String,?>changedValues()returns a dictionary with the keys and (new) values that have been changed since last fetching or saving the object (this is implemented efficiently without firing relationship faults)NSDictionary<java.lang.String,?>changedValuesForCurrentEvent()static NSArray<java.lang.String>classFallbacksForKeyedArchiver()static org.moe.natj.objc.ClassclassForKeyedUnarchiver()NSDictionary<java.lang.String,?>committedValuesForKeys(NSArray<java.lang.String> keys)returns a dictionary of the last fetched or saved keys and values of this object.static booleancontextShouldIgnoreUnmodeledPropertyChanges()Distinguish between changes that should and should not dirty the object for any key unknown to Core Data. 10.5 & earlier default to NO. 10.6 and later default to YES.static java.lang.StringdebugDescription_static()static java.lang.Stringdescription_static()voiddidAccessValueForKey(java.lang.String key)read notification (together with willAccessValueForKey used to maintain inverse relationships, to fire faults, etc.) - each read access has to be wrapped in this method pair (in the same way as each write access has to be wrapped in the KVO method pair)voiddidChangeValueForKey(java.lang.String key)voiddidChangeValueForKeyWithSetMutationUsingObjects(java.lang.String inKey, long inMutationKind, NSSet<?> inObjects)voiddidSave()commonly used to notify other objects after a savevoiddidTurnIntoFault()commonly used to clear out additional transient values or cachesNSEntityDescriptionentity()static NSEntityDescriptionentity_static()The Entity represented by this subclass.longfaultingState()Allow developers to determine if an object is in a transitional phase when receiving a KVO notification.static NSFetchRequest<?>fetchRequest()A new fetch request initialized with the Entity represented by this subclass.booleanhasChanges()booleanhasFaultForRelationshipNamed(java.lang.String key)returns a Boolean indicating if the relationship for the specified key is a fault.static longhash_static()booleanhasPersistentChangedValues()returns YES if any persistent properties do not compare isEqual to their last saved state.NSManagedObjectinit()NSManagedObjectinitWithContext(NSManagedObjectContext moc)Returns a new object, inserted into managedObjectContext.NSManagedObjectinitWithEntityInsertIntoManagedObjectContext(NSEntityDescription entity, NSManagedObjectContext context)The designated initializer.static NSObject.Function_instanceMethodForSelector_retinstanceMethodForSelector(org.moe.natj.objc.SEL aSelector)static NSMethodSignatureinstanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)static booleaninstancesRespondToSelector(org.moe.natj.objc.SEL aSelector)booleanisDeleted()booleanisFault()this information is useful in many situations when computations are optional - this can be used to avoid growing the object graph unnecessarily (which allows to control performance as it can avoid time consuming fetches from databases)booleanisInserted()state - methodsstatic booleanisSubclassOfClass(org.moe.natj.objc.Class aClass)booleanisUpdated()static NSSet<java.lang.String>keyPathsForValuesAffectingValueForKey(java.lang.String key)NSManagedObjectContextmanagedObjectContext()identitystatic java.lang.Objectnew_objc()NSManagedObjectIDobjectID()NSArray<? extends NSManagedObjectID>objectIDsForRelationshipNamed(java.lang.String key)returns an array of objectIDs for the contents of a relationship.voidprepareForDeletion()Callback before delete propagation while the object is still alive.java.lang.ObjectprimitiveValueForKey(java.lang.String key)primitive methods give access to the generic dictionary storage from subclasses that implement explicit accessors like -setName/-name to add custom document logicstatic booleanresolveClassMethod(org.moe.natj.objc.SEL sel)static booleanresolveInstanceMethod(org.moe.natj.objc.SEL sel)voidsetPrimitiveValueForKey(java.lang.Object value, java.lang.String key)voidsetValueForKey(java.lang.Object value, java.lang.String key)KVC - overridden to access generic dictionary storage unless subclasses explicitly provide accessorsstatic voidsetVersion_static(long aVersion)static org.moe.natj.objc.Classsuperclass_static()booleanvalidateForDelete(org.moe.natj.general.ptr.Ptr<NSError> error)booleanvalidateForInsert(org.moe.natj.general.ptr.Ptr<NSError> error)booleanvalidateForUpdate(org.moe.natj.general.ptr.Ptr<NSError> error)booleanvalidateValueForKeyError(org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> value, java.lang.String key, org.moe.natj.general.ptr.Ptr<NSError> error)KVCjava.lang.ObjectvalueForKey(java.lang.String key)KVC - overridden to access generic dictionary storage unless subclasses explicitly provide accessorsstatic longversion_static()voidwillAccessValueForKey(java.lang.String key)read notificationvoidwillChangeValueForKey(java.lang.String key)KVO change notificationvoidwillChangeValueForKeyWithSetMutationUsingObjects(java.lang.String inKey, long inMutationKind, NSSet<?> inObjects)Given a key that identifies an _unordered_ to-many relationship, send -observeValueForKeyPath:ofObject:change:context: notification messages to each observer registered for the key, including those that are registered with other objects using key paths that locate the keyed value in this object.voidwillSave()commonly used to compute persisted values from other transient/scratchpad values, to set timestamps, etc. - this method can have "side effects" on the persisted valuesvoidwillTurnIntoFault()invoked automatically by the Core Data framework before receiver is converted (back) to a fault.-
Methods inherited from class apple.NSObject
accessibilityActivate, accessibilityActivationPoint, accessibilityAssistiveTechnologyFocusedIdentifiers, accessibilityAttributedHint, accessibilityAttributedLabel, accessibilityAttributedUserInputLabels, accessibilityAttributedValue, accessibilityContainerType, accessibilityCustomActions, accessibilityCustomRotors, accessibilityDecrement, accessibilityDragSourceDescriptors, accessibilityDropPointDescriptors, accessibilityElementAtIndex, accessibilityElementCount, accessibilityElementDidBecomeFocused, accessibilityElementDidLoseFocus, accessibilityElementIsFocused, accessibilityElements, accessibilityElementsHidden, accessibilityFrame, accessibilityHint, accessibilityIncrement, accessibilityLabel, accessibilityLanguage, accessibilityNavigationStyle, accessibilityPath, accessibilityPerformEscape, accessibilityPerformMagicTap, accessibilityRespondsToUserInteraction, accessibilityScroll, accessibilityTextualContext, accessibilityTraits, accessibilityUserInputLabels, accessibilityValue, accessibilityViewIsModal, addObserverForKeyPathOptionsContext, attemptRecoveryFromErrorOptionIndex, attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo, autoContentAccessingProxy, awakeAfterUsingCoder, awakeFromNib, class_objc, classForCoder, classForKeyedArchiver, copy, dealloc, debugDescription, description, dictionaryWithValuesForKeys, didChangeValuesAtIndexesForKey, doesNotRecognizeSelector, fileManagerShouldProceedAfterError, fileManagerWillProcessPath, finalize_objc, forwardingTargetForSelector, forwardInvocation, hash, indexOfAccessibilityElement, isAccessibilityElement, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableArrayValueForKey, mutableArrayValueForKeyPath, mutableCopy, mutableOrderedSetValueForKey, mutableOrderedSetValueForKeyPath, mutableSetValueForKey, mutableSetValueForKeyPath, observationInfo, observeValueForKeyPathOfObjectChangeContext, performSelector, performSelectorInBackgroundWithObject, performSelectorOnMainThreadWithObjectWaitUntilDone, performSelectorOnMainThreadWithObjectWaitUntilDoneModes, performSelectorOnThreadWithObjectWaitUntilDone, performSelectorOnThreadWithObjectWaitUntilDoneModes, performSelectorWithObject, performSelectorWithObjectAfterDelay, performSelectorWithObjectAfterDelayInModes, performSelectorWithObjectWithObject, prepareForInterfaceBuilder, provideImageDataBytesPerRowOrigin_Size_UserInfo, removeObserverForKeyPath, removeObserverForKeyPathContext, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, self, setAccessibilityActivationPoint, setAccessibilityAttributedHint, setAccessibilityAttributedLabel, setAccessibilityAttributedUserInputLabels, setAccessibilityAttributedValue, setAccessibilityContainerType, setAccessibilityCustomActions, setAccessibilityCustomRotors, setAccessibilityDragSourceDescriptors, setAccessibilityDropPointDescriptors, setAccessibilityElements, setAccessibilityElementsHidden, setAccessibilityFrame, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLanguage, setAccessibilityNavigationStyle, setAccessibilityPath, setAccessibilityRespondsToUserInteraction, setAccessibilityTextualContext, setAccessibilityTraits, setAccessibilityUserInputLabels, setAccessibilityValue, setAccessibilityViewIsModal, setIsAccessibilityElement, setNilValueForKey, setObservationInfo, setShouldGroupAccessibilityChildren, setValueForKeyPath, setValueForUndefinedKey, setValuesForKeysWithDictionary, shouldGroupAccessibilityChildren, superclass, validateValueForKeyPathError, valueForKeyPath, valueForUndefinedKey, willChangeValuesAtIndexesForKey
-
-
-
-
Method Detail
-
accessInstanceVariablesDirectly
public static boolean accessInstanceVariablesDirectly()
-
alloc
public static NSManagedObject alloc()
-
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()
-
contextShouldIgnoreUnmodeledPropertyChanges
public static boolean contextShouldIgnoreUnmodeledPropertyChanges()
Distinguish between changes that should and should not dirty the object for any key unknown to Core Data. 10.5 & earlier default to NO. 10.6 and later default to YES. Similarly, transient attributes may be individually flagged as not dirtying the object by adding +(BOOL)contextShouldIgnoreChangesForwhere is the property name.
-
debugDescription_static
public static java.lang.String debugDescription_static()
-
description_static
public static java.lang.String description_static()
-
entity_static
public static NSEntityDescription entity_static()
The Entity represented by this subclass. This method is only legal to call on subclasses of NSManagedObject that represent a single entity in the model.
-
fetchRequest
public static NSFetchRequest<?> fetchRequest()
A new fetch request initialized with the Entity represented by this subclass. This property's getter is only legal to call on subclasses of NSManagedObject that represent a single entity in the model.
-
hash_static
public static long hash_static()
-
instanceMethodForSelector
public static NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(org.moe.natj.objc.SEL aSelector)
-
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)
-
new_objc
public static java.lang.Object new_objc()
-
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()
-
awakeFromFetch
public void awakeFromFetch()
invoked after a fetch or after unfaulting (commonly used for computing derived values from the persisted properties)
-
awakeFromInsert
public void awakeFromInsert()
invoked after an insert (commonly used for initializing special default/initial settings)
-
awakeFromSnapshotEvents
public void awakeFromSnapshotEvents(long flags)
Callback for undo, redo, and other multi-property state resets
-
changedValues
public NSDictionary<java.lang.String,?> changedValues()
returns a dictionary with the keys and (new) values that have been changed since last fetching or saving the object (this is implemented efficiently without firing relationship faults)
-
changedValuesForCurrentEvent
public NSDictionary<java.lang.String,?> changedValuesForCurrentEvent()
-
committedValuesForKeys
public NSDictionary<java.lang.String,?> committedValuesForKeys(NSArray<java.lang.String> keys)
returns a dictionary of the last fetched or saved keys and values of this object. Pass nil to get all persistent modeled properties.
-
didAccessValueForKey
public void didAccessValueForKey(java.lang.String key)
read notification (together with willAccessValueForKey used to maintain inverse relationships, to fire faults, etc.) - each read access has to be wrapped in this method pair (in the same way as each write access has to be wrapped in the KVO method pair)
-
didChangeValueForKey
public void didChangeValueForKey(java.lang.String key)
- Overrides:
didChangeValueForKeyin classNSObject
-
didChangeValueForKeyWithSetMutationUsingObjects
public void didChangeValueForKeyWithSetMutationUsingObjects(java.lang.String inKey, long inMutationKind, NSSet<?> inObjects)- Overrides:
didChangeValueForKeyWithSetMutationUsingObjectsin classNSObject
-
didSave
public void didSave()
commonly used to notify other objects after a save
-
didTurnIntoFault
public void didTurnIntoFault()
commonly used to clear out additional transient values or caches
-
entity
public NSEntityDescription entity()
-
faultingState
public long faultingState()
Allow developers to determine if an object is in a transitional phase when receiving a KVO notification. Returns 0 if the object is fully initialized as a managed object and not transitioning to or from another state
-
hasChanges
public boolean hasChanges()
-
hasFaultForRelationshipNamed
public boolean hasFaultForRelationshipNamed(java.lang.String key)
returns a Boolean indicating if the relationship for the specified key is a fault. If a value of NO is returned, the resulting relationship is a realized object; otherwise the relationship is a fault. If the specified relationship is a fault, calling this method does not result in the fault firing.
-
hasPersistentChangedValues
public boolean hasPersistentChangedValues()
returns YES if any persistent properties do not compare isEqual to their last saved state. Relationship faults will not be unnecessarily fired. This differs from the existing -hasChanges method which is a simple dirty flag and also includes transient properties
-
init
public NSManagedObject init()
-
initWithContext
public NSManagedObject initWithContext(NSManagedObjectContext moc)
Returns a new object, inserted into managedObjectContext. This method is only legal to call on subclasses of NSManagedObject that represent a single entity in the model.
-
initWithEntityInsertIntoManagedObjectContext
public NSManagedObject initWithEntityInsertIntoManagedObjectContext(NSEntityDescription entity, NSManagedObjectContext context)
The designated initializer.
-
isDeleted
public boolean isDeleted()
-
isFault
public boolean isFault()
this information is useful in many situations when computations are optional - this can be used to avoid growing the object graph unnecessarily (which allows to control performance as it can avoid time consuming fetches from databases)
-
isInserted
public boolean isInserted()
state - methods
-
isUpdated
public boolean isUpdated()
-
managedObjectContext
public NSManagedObjectContext managedObjectContext()
identity
-
objectID
public NSManagedObjectID objectID()
-
objectIDsForRelationshipNamed
public NSArray<? extends NSManagedObjectID> objectIDsForRelationshipNamed(java.lang.String key)
returns an array of objectIDs for the contents of a relationship. to-one relationships will return an NSArray with a single NSManagedObjectID. Optional relationships may return an empty NSArray. The objectIDs will be returned in an NSArray regardless of the type of the relationship.
-
prepareForDeletion
public void prepareForDeletion()
Callback before delete propagation while the object is still alive. Useful to perform custom propagation before the relationships are torn down or reconfigure KVO observers.
-
primitiveValueForKey
public java.lang.Object primitiveValueForKey(java.lang.String key)
primitive methods give access to the generic dictionary storage from subclasses that implement explicit accessors like -setName/-name to add custom document logic
-
setPrimitiveValueForKey
public void setPrimitiveValueForKey(java.lang.Object value, java.lang.String key)
-
setValueForKey
public void setValueForKey(java.lang.Object value, java.lang.String key)KVC - overridden to access generic dictionary storage unless subclasses explicitly provide accessors- Overrides:
setValueForKeyin classNSObject
-
validateForDelete
public boolean validateForDelete(org.moe.natj.general.ptr.Ptr<NSError> error)
-
validateForInsert
public boolean validateForInsert(org.moe.natj.general.ptr.Ptr<NSError> error)
-
validateForUpdate
public boolean validateForUpdate(org.moe.natj.general.ptr.Ptr<NSError> error)
-
validateValueForKeyError
public boolean validateValueForKeyError(org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> value, java.lang.String key, org.moe.natj.general.ptr.Ptr<NSError> error)KVC- Overrides:
validateValueForKeyErrorin classNSObject
-
valueForKey
public java.lang.Object valueForKey(java.lang.String key)
KVC - overridden to access generic dictionary storage unless subclasses explicitly provide accessors- Overrides:
valueForKeyin classNSObject
-
willAccessValueForKey
public void willAccessValueForKey(java.lang.String key)
read notification
-
willChangeValueForKey
public void willChangeValueForKey(java.lang.String key)
KVO change notification- Overrides:
willChangeValueForKeyin classNSObject
-
willChangeValueForKeyWithSetMutationUsingObjects
public void willChangeValueForKeyWithSetMutationUsingObjects(java.lang.String inKey, long inMutationKind, NSSet<?> inObjects)Description copied from class:NSObjectGiven a key that identifies an _unordered_ to-many relationship, send -observeValueForKeyPath:ofObject:change:context: notification messages to each observer registered for the key, including those that are registered with other objects using key paths that locate the keyed value in this object. The passed-in mutation kind corresponds to an NSMutableSet method. The passed-in set must contain the set that would be passed to the corresponding NSMutableSet method. Invocations of these methods must always be paired, with identical arguments. The value of the NSKeyValueChangeKindKey entry in change dictionaries in notifications resulting from use of these methods depends on the passed-in mutationKind value: - NSKeyValueUnionSetMutation -> NSKeyValueChangeInsertion - NSKeyValueMinusSetMutation -> NSKeyValueChangeRemoval - NSKeyValueIntersectSetMutation -> NSKeyValueChangeRemoval - NSKeyValueSetSetMutation -> NSKeyValueChangeReplacement The change dictionaries may also contain optional entries: - The NSKeyValueChangeOldKey entry, if present (only for for NSKeyValueChangeRemoval and NSKeyValueChangeReplacement), contains the set of objects that were removed. - The NSKeyValueChangeNewKey entry, if present (only for NSKeyValueChangeInsertion and NSKeyValueChangeReplacement), contains the set of objects that were added.- Overrides:
willChangeValueForKeyWithSetMutationUsingObjectsin classNSObject
-
willSave
public void willSave()
commonly used to compute persisted values from other transient/scratchpad values, to set timestamps, etc. - this method can have "side effects" on the persisted values
-
willTurnIntoFault
public void willTurnIntoFault()
invoked automatically by the Core Data framework before receiver is converted (back) to a fault. This method is the companion of the -didTurnIntoFault method, and may be used to (re)set state which requires access to property values (for example, observers across keypaths.) The default implementation does nothing.
-
-