[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

api[apple,CoreData]

References:


TargetOS := (Smalltalk includesKey: #UIView)
	ifTrue: [ #iOS ] ifFalse: [ #OSX ]!
#(	#NSPropertyDescription
	#NSEntityDescription
	#NSPersistentStoreRequest
	#NSManagedObjectModel
	#NSManagedObject
	#NSManagedObjectID
	#NSManagedObjectContext
	#NSPersistentStoreCoordinator
	#NSPersistentStore
	#NSAtomicStoreCacheNode
	#NSEntityMigrationPolicy
	#NSMappingModel
	#NSEntityMapping
	#NSPropertyMapping
	#NSMigrationManager
	#NSIncrementalStoreNode
	#NSPersistentStoreResult
	#NSMergeConflict
	#NSMergePolicy
	#NSFetchedResultsController
) do:[each| NSObject subclass: each category: #CoreData ] !

" COREDATA_EXTERN double NSCoreDataVersionNumber "

"COREDATA_EXTERN NSString * const NSDetailedErrorsKey 
COREDATA_EXTERN NSString * const NSValidationObjectErrorKey 
COREDATA_EXTERN NSString * const NSValidationKeyErrorKey 
COREDATA_EXTERN NSString * const NSValidationPredicateErrorKey 
COREDATA_EXTERN NSString * const NSValidationValueErrorKey 
COREDATA_EXTERN NSString * const NSAffectedStoresErrorKey 
COREDATA_EXTERN NSString * const NSAffectedObjectsErrorKey 
COREDATA_EXTERN NSString * const NSPersistentStoreSaveConflictsErrorKey 
COREDATA_EXTERN NSString * const NSSQLiteErrorDomain 
"!
| buildPool line |
buildPool := [ :poolName :stream | | pool line |
	pool := Smalltalk at: poolName put: PoolDictionary new.
	[stream atEnd] whileFalse: [
		line := ((stream nextLine upTo: $/)upTo: $,) trimBlanks.
		line notEmpty ifTrue: [	| key number |
			line := line stream.
			key := ((line upTo: $=) trimBlanks upTo: $ ) asGlobalName.
			number := Number fromString: line upToEnd trimBlanks.
			pool at: key put: number.
		].
	].
].
buildPool value: #CoreDataErrors value: '
    NSManagedObjectValidationError                   = 1550,   // generic validation error
    NSValidationMultipleErrorsError                  = 1560,   // generic message for error containing multiple validation errors
    NSValidationMissingMandatoryPropertyError        = 1570,   // non-optional property with a nil value
    NSValidationRelationshipLacksMinimumCountError   = 1580,   // to-many relationship with too few destination objects
    NSValidationRelationshipExceedsMaximumCountError = 1590,   // bounded, to-many relationship with too many destination objects
    NSValidationRelationshipDeniedDeleteError        = 1600,   // some relationship with NSDeleteRuleDeny is non-empty
    NSValidationNumberTooLargeError                  = 1610,   // some numerical value is too large
    NSValidationNumberTooSmallError                  = 1620,   // some numerical value is too small
    NSValidationDateTooLateError                     = 1630,   // some date value is too late
    NSValidationDateTooSoonError                     = 1640,   // some date value is too soon
    NSValidationInvalidDateError                     = 1650,   // some date value fails to match date pattern
    NSValidationStringTooLongError                   = 1660,   // some string value is too long
    NSValidationStringTooShortError                  = 1670,   // some string value is too short
    NSValidationStringPatternMatchingError           = 1680,   // some string value fails to match some pattern
    
    NSManagedObjectContextLockingError               = 132000, // cant acquire a lock in a managed object context
    NSPersistentStoreCoordinatorLockingError         = 132010, // cant acquire a lock in a persistent store coordinator
    
    NSManagedObjectReferentialIntegrityError         = 133000, // attempt to fire a fault pointing to an object that does not exist (we can see the store, we cant see the object)
    NSManagedObjectExternalRelationshipError         = 133010, // an object being saved has a relationship containing an object from another store
    NSManagedObjectMergeError                        = 133020, // merge policy failed - unable to complete merging
    
    NSPersistentStoreInvalidTypeError                = 134000, // unknown persistent store type/format/version
    NSPersistentStoreTypeMismatchError               = 134010, // returned by persistent store coordinator if a store is accessed that does not match the specified type
    NSPersistentStoreIncompatibleSchemaError         = 134020, // store returned an error for save operation (database level errors ie missing table, no permissions)
    NSPersistentStoreSaveError                       = 134030, // unclassified save error - something we depend on returned an error
    NSPersistentStoreIncompleteSaveError             = 134040, // one or more of the stores returned an error during save (stores/objects that failed will be in userInfo)
	NSPersistentStoreSaveConflictsError				 = 134050, // an unresolved merge conflict was encountered during a save.  userInfo has NSPersistentStoreSaveConflictsErrorKey

    NSCoreDataError                                  = 134060, // general Core Data error
    NSPersistentStoreOperationError                  = 134070, // the persistent store operation failed 
    NSPersistentStoreOpenError                       = 134080, // an error occurred while attempting to open the persistent store
    NSPersistentStoreTimeoutError                    = 134090, // failed to connect to the persistent store within the specified timeout (see NSPersistentStoreTimeoutOption)
	NSPersistentStoreUnsupportedRequestTypeError	 = 134091, // an NSPersistentStore subclass was passed an NSPersistentStoreRequest that it did not understand
    
    NSPersistentStoreIncompatibleVersionHashError    = 134100, // entity version hashes incompatible with data model
    NSMigrationError                                 = 134110, // general migration error
    NSMigrationCancelledError                        = 134120, // migration failed due to manual cancellation
    NSMigrationMissingSourceModelError               = 134130, // migration failed due to missing source data model
    NSMigrationMissingMappingModelError              = 134140, // migration failed due to missing mapping model
    NSMigrationManagerSourceStoreError               = 134150, // migration failed due to a problem with the source data store
    NSMigrationManagerDestinationStoreError          = 134160, // migration failed due to a problem with the destination data store
    NSEntityMigrationPolicyError                     = 134170, // migration failed during processing of the entity migration policy 

    NSSQLiteError                                    = 134180,  // general SQLite error 

    NSInferredMappingModelError                      = 134190, // inferred mapping model creation error
    NSExternalRecordImportError                      = 134200 // general error encountered while importing external records
' stream.

buildPool value: #NSAttributeType value: '
    NSUndefinedAttributeType = 0,
    NSInteger16AttributeType = 100,
    NSInteger32AttributeType = 200,
    NSInteger64AttributeType = 300,
    NSDecimalAttributeType = 400,
    NSDoubleAttributeType = 500,
    NSFloatAttributeType = 600,
    NSStringAttributeType = 700,
    NSBooleanAttributeType = 800,
    NSDateAttributeType = 900,
    NSBinaryDataAttributeType = 1000,
    NSTransformableAttributeType = 1800,
    NSObjectIDAttributeType = 2000' stream.
!

NSPropertyDescription buildTypedGetters: #(
	#(entity #NSEntityDescription)
	#(versionHash #NSData)
)!
NSPropertyDescription buildAccessors: #(
	name userInfo versionHashModifier
	renamingIdentifier
)!
NSPropertyDescription buildIsBooleanAccessors: #(
	optional transient indexed
	indexedBySpotlight
	storedInExternalRecord
)!
NSPropertyDescription buildGetters: #(
	validationPredicates validationWarnings
)!
NSPropertyDescription buildFunctions: #(
	#(#setValidationPredicates:withValidationWarnings: #(predicates warnings))
)!

NSPropertyDescription subclass: #NSAttributeDescription !
NSAttributeDescription buildNumberAccessors: #(
	attributeType
)!
NSAttributeDescription buildAccessors: #(
	attributeValueClassName
	valueTransformerName
)!
NSAttributeDescription buildTypedAccessors: #(
	#(defaultValue #NSObject)
)!
NSAttributeDescription buildBooleanAccessors: #(
	allowsExternalBinaryDataStorage
)!

! NSEntityDescription class methodsFor: #instantiation !
entityForName: entityName inManagedObjectContext: context

	^self @ (self nativeClass
		entityForName: entityName
		inManagedObjectContext: context handle)! !

! NSEntityDescription class methodsFor: #instantiation !
insertNewObjectForEntityForName: entityName inManagedObjectContext: context

	^self @ (self nativeClass
		insertNewObjectForEntityForName: entityName
		inManagedObjectContext: context handle)! !

NSEntityDescription buildTypedGetters: #(
	#(managedObjectModel #NSManagedObjectModel)
	#(superentity #NSEntityDescription)
	#(versionHash #NSData)
)!
NSEntityDescription buildAccessors: #(
	name managedObjectClassName
	subentities properties userInfo
	versionHashModifier
	renamingIdentifier
	compoundIndexes
)!
NSEntityDescription buildIsBooleanGetters: #(
	abstract
)!
NSEntityDescription buildGetters: #(
	subentitiesByName propertiesByName
	attributesByName relationshipsByName
)!
NSEntityDescription buildFunctions: #(
	#(#relationshipsWithDestinationEntity: #(#(entity handle)))
	#(#isKindOfEntity: #(#(entity handle)))
)!

NSPropertyDescription subclass: #NSFetchedPropertyDescription !
NSFetchedPropertyDescription buildTypedGetters: #(
	#(fetchRequest #NSFetchRequest)
)!

NSPropertyDescription subclass: #NSExpressionDescription !
NSExpressionDescription buildTypedGetters: #(
	#(expression #NSExpression)
)!
NSExpressionDescription buildNumberAccessors: #(
	expressionResultType
)!

NSPropertyDescription subclass: #NSRelationshipDescription !
NSRelationshipDescription buildPool: #NSDeleteRule with: #(
	#NSNoActionDeleteRule
	#NSNullifyDeleteRule
 	#NSCascadeDeleteRule
	#NSDenyDeleteRule
)!
NSRelationshipDescription buildTypedAccessors: #(
	#(destinationEntity #NSEntityDescription)
	#(inverseRelationship #NSRelationshipDescription)
	#(deleteRule #NSDeleteRule)
)!
NSRelationshipDescription buildNumberAccessors: #(
	maxCount minCount
)!
NSRelationshipDescription buildIsBooleanAccessors: #(
	toMany ordered
)!
NSRelationshipDescription buildTypedGetters: #(
	#(versionHash #NSData)
)!

NSPersistentStoreRequest buildPool: #NSPersistentStoreRequestType with: #(
	1 #NSFetchRequestType #NSSaveRequestType
	6 #NSBatchUpdateRequestType
)!
NSPersistentStoreRequest buildAccessors: #(
	affectedStores
)!
NSPersistentStoreRequest buildNumberGetters: #(
	requestType
)!

NSPersistentStoreRequest subclass: #NSAsynchronousFetchRequest !
NSAsynchronousFetchRequest buildTypedGetters: #(
	#(fetchRequest #NSFetchRequest)
)!
" to do...
@property (strong, readonly) NSPersistentStoreAsynchronousFetchResultCompletionBlock completionBlock;
"
NSAsynchronousFetchRequest buildNumberAccessors: #(
	estimatedResultCount
)!
! NSAsynchronousFetchRequest class methodsFor: #instantiation !
withFetchRequest: request completionBlock: block

	^self @ (self nativeClass
		instanceWithFetchRequest: request handle
		completionBlock: block handle)! !

NSPersistentStoreRequest subclass: #NSFetchRequest !
NSFetchRequest buildPool: #NSFetchRequestResultType with: #(
	0 #NSManagedObjectResultType
	#NSManagedObjectIDResultType
	#NSDictionaryResultType
	4 #NSCountResultType
)!
! NSFetchRequest class methodsFor: #instantiation !
withEntityName: entityName

	^self @ (self nativeClass
		fetchRequestWithEntityName: entityName)! !

NSFetchRequest buildTypedAccessors: #(
	#(entity #NSEntityDescription)
	#(predicate #NSPredicate)
	#(havingPredicate #NSPredicate)
)!
NSFetchRequest buildAccessors: #(
	entityName sortDescriptors affectedStores
	relationshipKeyPathsForPrefetching
	propertiesToFetch
	propertiesToGroupBy
)!
NSFetchRequest buildNumberAccessors: #(
	fetchLimit resultType
	fetchOffset fetchBatchSize
)!
NSFetchRequest buildBooleanAccessors: #(
	includesSubentities includesPropertyValues
	returnsObjectsAsFaults includesPendingChanges
	returnsDistinctResults shouldRefreshRefetchedObjects
)!

NSExpression isNil ifTrue: [
	self error: 'Requires NSExpression @ Foundation'
]!
NSExpression subclass: #NSFetchRequestExpression !
NSFetchRequestExpression buildPool: #NSFetchRequestExpressionType with: #(
	50 #NSFetchRequestExpressionType
)!

! NSFetchRequestExpression class methodsFor: #instantiation !
forFetch: fetch context: context countOnly: aBoolean

	^self @ (self nativeClass
		expressionForFetch: fetch handle
		context: context handle
		countOnly: aBoolean)! !

NSFetchRequestExpression buildTypedGetters: #(
	#(requestExpression #NSExpression)
	#(contextExpression #NSExpression)
)!
NSFetchRequestExpression buildIsBooleanGetters: #(
	countOnlyRequest
)!

! NSManagedObjectModel class methodsFor: #instantiation !
fromBundles: bundles

	^self @ (self nativeClass
		mergedModelFromBundles: bundles handles)! !

! NSManagedObjectModel class methodsFor: #instantiation !
byMergingModels: models

	^self @ (self nativeClass
		modelByMergingModels: models handles)! !

! NSManagedObjectModel class methodsFor: #instantiation !
withContentsOfURL: url

	^self @ (self nativeClass
		instanceWithContentsOfURL: url handle)! !

NSManagedObjectModel buildGetters: #(
	entitiesByName
)!
NSManagedObjectModel buildAccessors: #(
	entities configurations
	localizationDictionary
	fetchRequestTemplatesByName
	entityVersionHashesByName
)!
NSManagedObjectModel buildFunctions: #(
	#(#entitiesForConfiguration: #(configuration))
	#(#setEntities:forConfiguration: #(entities configuration))
	#(#setFetchRequestTemplate:forName: #(#(fetchRequestTemplate handle) name))
	#(#fetchRequestTemplateForName: #(name) #NSFetchRequest)
	#(#fetchRequestFromTemplateWithName:substitutionVariables: #(name #(variables json)) #NSFetchRequest)
	#(#:: #(#(bundles handles) #()) #NSManagedObjectModel)
	#(versionIdentifiers #() #NSSet)
	#(#isConfiguration:compatibleWithStoreMetadata: #(configuration #(metadata json))
)!

! NSManagedObjectModel class methodsFor: #instantiation !
fromBundles: bundles forStoreMetadata: metadata

	^self @ (self nativeClass
		mergedModelFromBundles: bundles handles
		forStoreMetadata: metadata json)! !

! NSManagedObjectModel class methodsFor: #instantiation !
byMergingModels: models forStoreMetadata: metadata

	^self @ (self nativeClass
		modelByMergingModels: models handles
		forStoreMetadata: metadata json)! !

NSManagedObject buildPool: #NSSnapshotEventType with: (#(
	1 #NSSnapshotEventUndoInsertion
	2 #NSSnapshotEventUndoDeletion
	3 #NSSnapshotEventUndoUpdate
	4 #NSSnapshotEventRollback
	5 #NSSnapshotEventRefresh
	6 #NSSnapshotEventMergePolicy
) collect:[:each| each isNumber ifTrue: [ 1 #>> each ] ifFalse: [each]])!

! NSManagedObject class methodsFor: #query !
contextShouldIgnoreUnmodeledPropertyChanges

	^self nativeClass contextShouldIgnoreUnmodeledPropertyChanges! !

! NSManagedObject class methodsFor: #instantiation !
withEntity: entity insertIntoManagedObjectContext: context

	^self @ (self nativeClass
		instanceWithEntity: entity handle
		insertIntoManagedObjectContext: context handle)! !

NSManagedObject buildTypedGetters: #(
	#(managedObjectContext #NSManagedObjectContext)
	#(entity #NSEntityDescription)
	#(objectID #NSManagedObjectID)
)!
NSManagedObject buildIsBooleanGetters: #(
	inserted updated deleted fault
)!
NSManagedObject buildBooleanGetters: #(
	hasChanges
)!
NSManagedObject buildNumberGetters: #(
	faultingState
)!
NSManagedObject buildFunctions: #(
	#(#hasFaultForRelationshipNamed: #(key))
	#(#willAccessValueForKey: #(key))
	#(#didAccessValueForKey: #(key))
	#(#willChangeValueForKey: #(key))
	#(#didChangeValueForKey: #(key))
	#(#willChangeValueForKey:withSetMutation:usingObjects: #(key inMutationKind #(inObjects handle)))
	#(#didChangeValueForKey:withSetMutation:usingObjects: #(key inMutationKind #(inObjects handle)))
	awakeFromFetch awakeFromInsert
	#(#awakeFromSnapshotEvents: #(flags))
	prepareForDeletion
	willSave didSave
	willTurnIntoFault didTurnIntoFault
	#(#valueForKey: #(key))
	#(#setValue:forKey: #(#(id handle) key))
	#(#primitiveValueForKey: #(key) #NSObject)
	#(#setPrimitiveValue:forKey: #(#(id handle) key))
	#(#committedValuesForKeys: #(keys))
	changedValues
	changedValuesForCurrentEvent
	#(#validateValue:forKey:error: #(#(value handle) key #(error handle)))
	#(#validateForDelete: #(#(error handle)))
	#(#validateForInsert: #(#(error handle)))
	#(#validateForUpdate: #(#(error handle)))
)!

NSManagedObjectID buildTypedGetters: #(
	#(entity #NSEntityDescription)
	#(persistentStore #NSPersistentStore)
)!
NSManagedObjectID buildIsBooleanGetters: #(
	temporaryID
)!
! NSManagedObjectID methodsFor: #accessing !
uriRepresentation

	^NSURL @ handle #URIRepresentation! !

NSManagedObjectContext buildPool: #NSManagedObjectContextConcurrencyType with: #(
	#NSConfinementConcurrencyType
	#NSPrivateQueueConcurrencyType
 	#NSMainQueueConcurrencyType
)!

! NSManagedObjectContext class methodsFor: #instantiation !
withConcurrencyType: aType

	^self @ (self nativeClass
		instanceWithConcurrencyType: aType)! !

NSManagedObjectContext buildTypedAccessors: #(
	#(persistentStoreCoordinator #NSPersistentStoreCoordinator)
	#(parentContext #NSManagedObjectContext)
	#(undoManager #NSUndoManager)
)!
NSManagedObjectContext buildAccessors: #(
	name userInfo
)!
NSManagedObjectContext buildBooleanGetters: #(
	hasChanges
)!
NSManagedObjectContext buildNumberGetters: #(
	concurrencyType
)!
NSManagedObjectContext buildFunctions: #(
	#(#performBlock: #(#(block handle)))
	#(#performBlockAndWait: #(#(block handle)))
	#(#objectRegisteredForID: #(#(objectID handle)) #NSManagedObject)
	#(#objectWithID: #(#(objectID handle)) #NSManagedObject)
	#(#existingObjectWithID:error: #(#(objectID handle) (#(nsError handle)) #NSManagedObject)
	#(#executeFetchRequest:error: #(#(request handle) (#(nsError handle)))
	#(#countForFetchRequest:error: #(#(request handle) (#(nsError handle)))
	#(#executeRequest:error: #(#(request handle) (#(nsError handle)) #NSPersistentStoreResult)
	#(#insertObject: #(#(object handle)))
	#(#deleteObject: #(#(object handle)))
	#(#refreshObject:mergeChanges: #(#(object handle) flag))
	#(#detectConflictsForObject: #(#(object handle)))
	#(#observeValueForKeyPath:ofObject:change:context: #(keyPath #(object handle) change #(context handle)))
	#processPendingChanges
	#(#assignObject:toPersistentStore: #(#(object handle) #(store handle)))
	undo redo reset rollback
	#(#save: #(#(nsError handle)))
	lock unlock tryLock
	#(#obtainPermanentIDsForObjects:error: #(#(objects handles)#(nsError handle)))
	#(#mergeChangesFromContextDidSaveNotification: #(#(notification handle)))
)!
NSManagedObjectContext buildTypedGetters: #(
	#(insertedObjects #NSSet)
	#(updatedObjects #NSSet)
	#(deletedObjects #NSSet)
	#(registeredObjects #NSSet)
)!
NSManagedObjectContext buildBooleanAccessors: #(
	hasChanges propagatesDeletesAtEndOfEvent
	retainsRegisteredObjects
)!
NSManagedObjectContext buildTypedAccessors: #(
	#(mergePolicy #NSObject)
)!

NSPersistentStoreCoordinator buildPool: #NSPersistentStoreUbiquitousTransitionType with: #(
	1 #NSPersistentStoreUbiquitousTransitionTypeAccountAdded
	#NSPersistentStoreUbiquitousTransitionTypeAccountRemoved
 	#NSPersistentStoreUbiquitousTransitionTypeContentRemoved
	#NSPersistentStoreUbiquitousTransitionTypeInitialImportCompleted
)!

! NSPersistentStoreCoordinator class methodsFor: #instantiation !
withManagedObjectModel: model

	^self @ (self nativeClass
		instanceWithManagedObjectModel: model handle)! !

NSPersistentStoreCoordinator buildTypedGetters: #(
	#(managedObjectModel #NSManagedObjectModel)
)!
NSPersistentStoreCoordinator buildGetters: #(
	persistentStores
)!
NSPersistentStoreCoordinator buildAccessors: #(
	name
)!
NSPersistentStoreCoordinator buildFunctions: #(
	#(#persistentStoreForURL: #(#(nsURL handle)) #NSPersistentStore)
	#(#setURL:forPersistentStore: #(#(nsURL handle) #(store handle)))
	#(#addPersistentStoreWithType:configuration:URL:options:error: #(storeType configuration #(storeURL handle) #(options json) #(error handle)) #NSPersistentStore)
	#(#removePersistentStore:error: #(#(store handle) #(error handle)))
)!
! NSPersistentStoreCoordinator methodsFor: #conversion !
urlForPersistentStore: store
	^NSURL @ (handle #URLForPersistentStore: store handle)! !

NSPersistentStoreCoordinator buildFunctions: #(
	#(#setMetadata:forPersistentStore: #(metadata #(store handle)))
	#(#metadataForPersistentStore: #(#(store handle)))
	#(#managedObjectIDForURIRepresentation: #(#(url handle)) #NSManagedObjectID)
	#(#executeRequest:withContext:error: #(#(request handle) #(context handle) #(error handle)) #NSObject)
	
)!
! NSPersistentStoreCoordinator class methodsFor: #constants !
registeredStoreTypes
	^self nativeClass registeredStoreTypes! !

! NSPersistentStoreCoordinator class methodsFor: #registration !
registerStoreClass: storeClass forStoreType: storeType
	^self nativeClass registerStoreClass: storeClass forStoreType: storeType! !

! NSPersistentStoreCoordinator class methodsFor: #accessing !
metadataForPersistentStoreOfType: storeType URL: url error: error
	^self nativeClass
		metadataForPersistentStoreOfType: storeType
		URL: url handle
		error: error handle! !

! NSPersistentStoreCoordinator class methodsFor: #tools !
removeUbiquitousContentAndPersistentStoreAtURL: url error: error
	^self nativeClass
		removeUbiquitousContentAndPersistentStoreAtURL: url handle
		options: options json error: error handle! !

! NSPersistentStoreCoordinator class methodsFor: #tools !
migratePersistentStore: store toURL: url options: options withType: storeType error: error
	^NSPersistentStore @(self nativeClass
		migratePersistentStore: store handle
		toURL: url handle
		options: options json
		withType: storeType
		error: error handle)! !

NSPersistentStoreCoordinator buildFunctions: #(
	#(#performBlock: #(#(block handle)))
	#(#performBlockAndWait: #(#(block handle)))
	lock unlock tryLock
)!

! NSPersistentStore class methodsFor: #instantiation !
withPersistentStoreCoordinator: root configurationName: name URL: url options: options

	^self @ (self nativeClass
		instanceWithPersistentStoreCoordinator: root handle
		configurationName: name URL: url handle
		options: options json)! !

! NSPersistentStore class methodsFor: #accessing !
metadataForPersistentStoreWithURL: url error: error

	^self nativeClass
		metadataForPersistentStoreWithURL: url handle
		error: error handle)! !

! NSPersistentStore class methodsFor: #accessing !
migrationManagerClass

	^self nativeClass migrationManagerClass! !

NSPersistentStore buildFunctions: #(
	#(loadMetadata: #(#(error handle)))
)!
NSPersistentStore buildTypedGetters: #(
	#(persistentStoreCoordinator: #NSPersistentStoreCoordinator)
)!
NSPersistentStore buildGetters: #(
	configurationName options
)!
NSPersistentStore buildAccessors: #(
	identifier metadata type
)!
NSPersistentStore buildIsBooleanGetters: #(
	readOnly
)!
! NSPersistentStore methodsFor: #accessing !
url
	^NSURL @ handle#URL! !

NSPersistentStore buildFunctions: #(
	#(#didAddToPersistentStoreCoordinator: #(#(coordinator handle)))
	#(#willRemoveFromPersistentStoreCoordinator: #(#(coordinator handle)))
)!

NSPersistentStore subclass: #NSAtomicStore!

! NSAtomicStore class methodsFor: #instantiation !
withPersistentStoreCoordinator: coordinator configurationName: name URL: url options: options

	^self @ (self nativeClass
		instanceWithPersistentStoreCoordinator: coordinator handle
		configurationName: name URL: url handle
		options: options json)! !

NSAtomicStore buildFunctions: #(
	#(#load: #(#(error handle)))
	#(#save: #(#(error handle)))
	#(#newCacheNodeForManagedObject: #(#(managedObject handle)) #NSAtomicStoreCacheNode)
	#(#updateCacheNode:fromManagedObject: #(#(node handle) #(managedObject handle)) #NSAtomicStoreCacheNode)
	#(cacheNodes #() #NSSet)
	#(#addCacheNodes: #(#(cacheNodes handle)))
	#(#willRemoveCacheNodes: #(#(cacheNodes handle)))
	#(#cacheNodeForObjectID: #(#(objectID handle)) #NSAtomicStoreCacheNode)
	#(#objectIDForEntity:referenceObject: #(#(entity handle) #(data handle)) #NSManagedObjectID)
	#(#newReferenceObjectForManagedObject: #(#(managedObject handle)) #NSObject)
	#(#referenceObjectForObjectID: #(#(objectID handle)) #NSObject)
)!
 
! NSAtomicStoreCacheNode class methodsFor: #instantiation !
withObjectID: moid

	^self @ (self nativeClass instanceWithObjectID: moid handle)! !

NSAtomicStoreCacheNode buildTypedGetters: #(
	#(objectID #NSManagedObjectID)
)!
NSAtomicStoreCacheNode buildAccessors: #(
	propertyCache
)!
NSAtomicStoreCacheNode buildFunctions: #(
	#(#valueForKey: #(key) #NSObject))
	#(#setValue:forKey: #(#(value handle) key) #NSObject))
)!

NSEntityMigrationPolicy buildFunctions: #(
	#(#beginEntityMapping:manager:error: #(#(mapping handle) #(manager handle) #(error handle) )))
	#(#createDestinationInstancesForSourceInstance:entityMapping:manager:error: #(#(sInstance handle) #(mapping handle) #(manager handle) #(error handle) )))
	#(#endInstanceCreationForEntityMapping:manager:error: #(#(mapping handle) #(manager handle) #(error handle) )))
	#(#createRelationshipsForDestinationInstance:entityMapping:manager:error: #(#(dInstance handle) #(mapping handle) #(manager handle) #(error handle) )))
	#(#endRelationshipCreationForEntityMapping:manager:error: #(#(mapping handle) #(manager handle) #(error handle) )))
	#(#performCustomValidationForEntityMapping:manager:error: #(#(mapping handle) #(manager handle) #(error handle) )))
	#(#endEntityMapping:manager:error: #(#(mapping handle) #(manager handle) #(error handle) )))
)!

! NSMappingModel class methodsFor: #instantiation !
fromBundles: bundles forSourceModel: sourceModel destinationModel: destinationModel

	^self @ (self nativeClass
		mappingModelFromBundles: bundles handles
		forSourceModel: sourceModel handle
		destinationModel: destinationModel handle)! !

! NSMappingModel class methodsFor: #instantiation !
inferredMappingModelForSourceModel: sourceModel destinationModel: destinationModel error: error

	^self @ (self nativeClass
		inferredMappingModelForSourceModel: sourceModel handle
		destinationModel: destinationModel handle
		error: error handle)! !

! NSMappingModel class methodsFor: #instantiation !
withContentsOfURL: url

	^self @ (self nativeClass
		instanceWithContentsOfURL: url handle)! !

NSMappingModel buildAccessors: #(
	entityMappings
)!
NSMappingModel buildGetters: #(
	entityMappingsByName
)!

NSEntityMapping buildPool: #NSEntityMappingType with: #(
	0 #NSUndefinedEntityMappingType
	#NSCustomEntityMappingType
 	#NSAddEntityMappingType
	#NSRemoveEntityMappingType
	#NSCopyEntityMappingType
	#NSTransformEntityMappingType
)!

NSEntityMapping buildAccessors: #(
	name sourceEntityName destinationEntityName
	attributeMappings relationshipMappings
	userInfo entityMigrationPolicyClassName
)!
NSEntityMapping buildNumberAccessors: #(
	mappingType
)!
NSEntityMapping buildTypedAccessors: #(
	#(sourceEntityVersionHash #NSData)
	#(destinationEntityVersionHash #NSData)
	#(sourceExpression #NSExpression)
)!

NSPropertyMapping buildAccessors: #(
	name userInfo
)!
NSPropertyMapping buildTypedAccessors: #(
	#(valueExpression #NSExpression)
)!


! NSMigrationManager class methodsFor: #instantiation !
withSourceModel: sourceModel destinationModel: destinationModel

	^self @ (self nativeClass
		instanceWithSourceModel: sourceModel handle
		destinationModel: destinationModel handle)! !

NSMigrationManager buildBooleanAccessors: #(
	usesStoreSpecificMigrationManager
)!
NSMigrationManager buildTypedAccessors: #(
	#(mappingModel #NSMappingModel)
	#(sourceModel #NSManagedObjectModel)
	#(destinationModel #NSManagedObjectModel)
)!
NSMigrationManager buildTypedGetters: #(
	#(sourceContext #NSManagedObjectContext)
	#(destinationContext #NSManagedObjectContext)
	#(currentEntityMapping #NSEntityMapping)
)!
NSMigrationManager buildAccessors: #(
	userInfo
)!
NSMigrationManager buildNumberGetters: #(
	migrationProgress
)!
NSMigrationManager buildFunctions: #(
	#(#migrateStoreFromURL:type:options:withMappingModel:toDestinationURL:destinationType:destinationOptions:error: #(#(sourceURL handle) sStoreType sOptions #(mappings handle) #(destinationURL handle) dStoreType destinationOptions #(error handle)))
	reset
	#(#sourceEntityForEntityMapping: #(#(mEntity handle))#NSEntityDescription)
	#(#destinationEntityForEntityMapping: #(#(mEntity handle))#NSEntityDescription)
	#(#associateSourceInstance:withDestinationInstance:forEntityMapping: #(#(sourceInstance handle) #(destinationInstance handle) #(entityMapping handle)))
	#(#destinationInstancesForEntityMappingNamed:sourceInstances: #(mappingName #(sourceInstances handles)))
	#(#sourceInstancesForEntityMappingNamed:destinationInstances: #(mappingName #(destinationInstances handles)))
	#(#cancelMigrationWithError: #(#(error handle)))
)!

NSPersistentStore subclass: #NSIncrementalStore!
NSPersistentStore buildFunctions: #(
	#(#loadMetadata: #(#(error handle)))
	#(#executeRequest:withContext:error: #(#(request handle) #(context handle) #(error handle))#NSObject)
	#(#newValuesForObjectWithID:withContext:error: #(#(objectID handle) #(context handle) #(error handle))#NSIncrementalStoreNode)
	#(#newValueForRelationship:withContext:error: #(#(relationship handle) #(context handle) #(error handle))#NSIncrementalStoreNode)
)!

! NSIncrementalStore class methodsFor: #accessing !
identifierForNewStoreAtURL: storeURL

	^NSObject @ (self nativeClass identifierForNewStoreAtURL: storeURL handle)! !

NSPersistentStore buildFunctions: #(
	#(#obtainPermanentIDsForObjects:error: #(#(array handles) #(error handle)))
	#(#managedObjectContextDidRegisterObjectsWithIDs: #(#(objectIDs handles)))
	#(#managedObjectContextDidUnregisterObjectsWithIDs: #(#(objectIDs handles)))
)!

NSPersistentStore buildFunctions: #(
	#(#newObjectIDForEntity:referenceObject: #(#(entity handle) #(data handle))#NSObject)
	#(#referenceObjectForObjectID: #(#(objectID handle))#NSObject)
)!

! NSIncrementalStoreNode class methodsFor: #instantiation !
withObjectID: objectID withValues: values version: version

	^self @ (self nativeClass
		instanceWithObjectID: objectID handle
		withValues: values json
		version: version)! !

NSIncrementalStoreNode buildFunctions: #(
	#(#updateWithValues:version: #(#(values json) version))
	#(#valueForPropertyDescription: #(#(prop handle))#NSObject)
)!
NSIncrementalStoreNode buildTypedGetters: #(
	#(objectID #NSManagedObjectID)
)!
NSIncrementalStoreNode buildNumberGetters: #(
	version
)!

NSPersistentStoreResult buildPool: #NSBatchUpdateRequestResultType with: #(
	0 #NSStatusOnlyResultType
	#NSUpdatedObjectIDsResultType
	#NSUpdatedObjectsCountResultType
)!

NSPersistentStoreResult subclass: #NSPersistentStoreAsynchronousResult !
NSPersistentStoreAsynchronousResult buildTypedGetters: #(
	#(managedObjectContext #NSManagedObjectContext)
	#(operationError #NSError)
	#(progress #NSProgress)
)!
NSPersistentStoreAsynchronousResult buildFunctions: #(
	cancel
)!

NSPersistentStoreResult subclass: #NSBatchUpdateResult !
NSBatchUpdateResult buildTypedGetters: #(
	#(result #NSObject)
)!
NSBatchUpdateResult buildNumberGetters: #(
	resultType
)!

NSPersistentStoreAsynchronousResult subclass: #NSAsynchronousFetchResult !
NSAsynchronousFetchResult buildTypedGetters: #(
	#(fetchRequest #NSAsynchronousFetchRequest)
)!
NSAsynchronousFetchResult buildGetters: #(
	finalResult
)!

NSPersistentStoreRequest subclass: #NSSaveChangesRequest!

! NSSaveChangesRequest class methodsFor: #instantiation !
withInsertedObjects: insertedObjects updatedObjects: updatedObjects deletedObjects: deletedObjects lockedObjects: lockedObjects

	^self @ (self nativeClass
		instanceWithInsertedObjects: insertedObjects handle
		updatedObjects: updatedObjects handle
		deletedObjects: deletedObjects handle
		lockedObjects: lockedObjects handle)! !

NSSaveChangesRequest buildTypedGetters: #(
	#(insertedObjects #NSSet)
	#(updatedObjects #NSSet)
	#(deletedObjects #NSSet)
	#(lockedObjects #NSSet)
)!

NSPersistentStoreRequest subclass: #NSBatchUpdateRequest!

! NSBatchUpdateRequest class methodsFor: #instantiation !
batchUpdateRequestWithEntityName: entityName

	^self @ (self nativeClass
		batchUpdateRequestWithEntityName: entityName)! !

! NSBatchUpdateRequest class methodsFor: #instantiation !
withEntityName: entityName

	^self @ (self nativeClass
		instanceWithEntityName: entityName)! !

! NSBatchUpdateRequest class methodsFor: #instantiation !
withEntity: aNSEntityDescription

	^self @ (self nativeClass
		instanceWithEntity: aNSEntityDescription handle)! !

NSBatchUpdateRequest buildGetters: #(
	entityName propertiesToUpdate
)!
NSBatchUpdateRequest buildTypedGetters: #(
	#(entity #NSEntityDescription)
)!
NSBatchUpdateRequest buildTypedAccessors: #(
	#(predicate #NSPredicate)
)!
NSBatchUpdateRequest buildBooleanAccessors: #(
	includesSubentities
)!
NSBatchUpdateRequest buildNumberAccessors: #(
	resultType
)!


NSMergePolicy buildPool: #NSMergePolicyType with: #(
	0 #NSErrorMergePolicyType
	#NSMergeByPropertyStoreTrumpMergePolicyType
	#NSMergeByPropertyObjectTrumpMergePolicyType
	#NSOverwriteMergePolicyType
	#NSRollbackMergePolicyType
)!

NSMergeConflict buildTypedGetters: #(
	#(sourceObject #NSManagedObject)
)!
NSMergeConflict buildGetters: #(
	objectSnapshot
	cachedSnapshot
	persistedSnapshot
)!
NSMergeConflict buildNumberGetters: #(
	newVersionNumber
	oldVersionNumber
)!

! NSMergeConflict class methodsFor: #instantiation !
withSource: srcObject
	newVersion: newvers oldVersion:oldvers
	cachedSnapshot: cachesnap persistedSnapshot: persnap

	^self @ (self nativeClass
		instanceWithSource: srcObject handle
		newVersion: newvers oldVersion:oldvers
		cachedSnapshot: cachesnap json
		persistedSnapshot: persnap json)! !

! NSMergePolicy class methodsFor: #instantiation !
withMergeType: ty

	^self @ (self nativeClass instanceWithMergeType: ty)! !

NSMergePolicy buildNumberGetters: #(
	mergeType
)!
NSMergePolicy buildFunctions: #(
	#(#resolveConflicts:error: #(#(list handles) #(error handle)))
)!

! NSFetchedResultsController class methodsFor: #instantiation !
withFetchRequest: fetchRequest managedObjectContext: context sectionNameKeyPath:sectionNameKeyPath cacheName: name

	^self @ (self nativeClass
		instanceWithFetchRequest: fetchRequest handle
		managedObjectContext: context handle
		sectionNameKeyPath: sectionNameKeyPath
		cacheName: name)! !

 NSFetchedResultsController buildFunctions: #(
	#(#performFetch: #(#(error handle)))
	#(#deleteCacheWithName: #(name))
	#(#objectAtIndexPath: #(#(indexPath handle))#NSObject)
	#(#indexPathForObject: #(#(object handle))#NSIndexPath)
	#(#sectionIndexTitleForSectionName: #(sectionName))
	#(#sectionForSectionIndexTitle:atIndex: #(title sectionIndex))
)!
NSFetchedResultsController buildTypedGetters: #(
	#(fetchRequest #NSFetchRequest)
	#(managedObjectContext #NSManagedObjectContext)
)!
NSFetchedResultsController buildGetters: #(
	sectionNameKeyPath cacheName
	fetchedObjects
	sectionIndexTitles
	sections
	name indexTitle
	objects
)!
NSFetchedResultsController buildTypedAccessors: #(
	#(delegate #NSObject)
)!
NSFetchedResultsController buildNumberGetters: #(
	numberOfObjects
)!

NSFetchedResultsController buildPool: #NSFetchedResultsChangeType with: #(
	1 #NSFetchedResultsChangeInsert
	#NSFetchedResultsChangeDelete
	#NSFetchedResultsChangeMove
	#NSFetchedResultsChangeUpdate
)!

NSFetchedResultsController buildFunctions: #(
	#(#controller:didChangeObject:atIndexPath:forChangeType:newIndexPath: #(#(controller handle) #(anObject handle) #(indexPath handle) type #(newIndexPath handle)))
	#(#controller:didChangeSection:atIndex:forChangeType: #(#(controller handle) #(sectionInfo handle) sectionIndex type))
	#(#controllerWillChangeContent: #(#(controller handle)))
	#(#controllerDidChangeContent: #(#(controller handle)))
	#(#controller:sectionIndexTitleForSectionName: #(#(controller handle) sectionName))
)!