Class NSManagedObjectModel

  • All Implemented Interfaces:
    NSCoding, NSCopying, NSFastEnumeration, NSObject

    public class NSManagedObjectModel
    extends NSObject
    implements NSCoding, NSCopying, NSFastEnumeration
    Models describe object graphs to be managed. Models (and their entities/properties/fetch request templates) are editable until they are used by a persistent store coordinator, allowing developers to create/modify them dynamically. However, once a model is being used, it MUST NOT be changed. When the persistent store coordinator first fetches data using a model, it will become uneditable. Any attempt to mutate a model or any of its subobjects after that point will cause an exception to be thrown. If you need to modify a model that is in use, create a copy, modify the copy, and then discard the objects with the old model.
    • Constructor Detail

      • NSManagedObjectModel

        protected NSManagedObjectModel​(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)
      • mergedModelFromBundles

        public static NSManagedObjectModel mergedModelFromBundles​(NSArray<? extends NSBundle> bundles)
        looks up all models in the specified bundles and merges them; if nil is specified as argument, uses the main bundle
      • mergedModelFromBundlesForStoreMetadata

        public static NSManagedObjectModel mergedModelFromBundlesForStoreMetadata​(NSArray<? extends NSBundle> bundles,
                                                                                  NSDictionary<java.lang.String,​?> metadata)
        Returns the managed object model used to create the store for the specified metadata. This method is a companion to the mergedModelFromBundles: method; in this case, the framework uses the version information stored in the metadata for a store to locate the models/entities used to create the store in the available bundles, and return the model. If the model for the store cannot be found, this method will return nil.
      • modelByMergingModelsForStoreMetadata

        public static NSManagedObjectModel modelByMergingModelsForStoreMetadata​(NSArray<? extends NSManagedObjectModel> models,
                                                                                NSDictionary<java.lang.String,​?> metadata)
        Returns a merged model from the specified array for the version information in the provided metadata. (This is the companion method to mergedModelFromBundles:forStoreMetadata:) If a model cannot be created to match the version information in the specified metadata, this method will return nil.
      • 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()
      • configurations

        public NSArray<java.lang.String> configurations()
        returns all available configuration names
      • copyWithZone

        public java.lang.Object copyWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
        Specified by:
        copyWithZone in interface NSCopying
      • countByEnumeratingWithStateObjectsCount

        public long countByEnumeratingWithStateObjectsCount​(org.moe.natj.general.ptr.VoidPtr state,
                                                            org.moe.natj.general.ptr.Ptr<org.moe.natj.objc.ObjCObject> buffer,
                                                            long len)
        Specified by:
        countByEnumeratingWithStateObjectsCount in interface NSFastEnumeration
      • entitiesForConfiguration

        public NSArray<? extends NSEntityDescription> entitiesForConfiguration​(java.lang.String configuration)
      • entityVersionHashesByName

        public NSDictionary<java.lang.String,​? extends NSData> entityVersionHashesByName()
        Returns a dictionary of the version hashes for the entities in the model, keyed by entity name. (The dictionary of version hash information is used by Core Data to determine schema compatibility.)
      • fetchRequestFromTemplateWithNameSubstitutionVariables

        public NSFetchRequest<?> fetchRequestFromTemplateWithNameSubstitutionVariables​(java.lang.String name,
                                                                                       NSDictionary<java.lang.String,​?> variables)
        returns a copy of the fetch request template with the variable bindings substituted - this is the usual way to bind an "abstractly" defined fetch request template to a concrete fetch
      • fetchRequestTemplateForName

        public NSFetchRequest<?> fetchRequestTemplateForName​(java.lang.String name)
      • fetchRequestTemplatesByName

        public NSDictionary<java.lang.String,​? extends NSFetchRequest<?>> fetchRequestTemplatesByName()
        Returns the dictionary of fetch request templates, keyed by name, for the model. If the template contains a predicate with substitution variables, you should instead use fetchRequestFromTemplateWithName:substitutionVariables: to create a new fetch request.
      • isConfigurationCompatibleWithStoreMetadata

        public boolean isConfigurationCompatibleWithStoreMetadata​(java.lang.String configuration,
                                                                  NSDictionary<java.lang.String,​?> metadata)
        Compares the version information in the store metadata with the entity version of a given configuration. Returns NO if there are differences between the version information. (For information on specific differences, developers should utilize the entityVersionHashesByName method, and perform a comparison.)
      • localizationDictionary

        public NSDictionary<java.lang.String,​java.lang.String> localizationDictionary()
        NSDictionary containing localized string values for entities, properties, and error strings related to this model. The key and value pattern follows: key = "Entity/NonLocalizedEntityName" value = "LocalizedEntityName" // for properties of the same non-localized name in differenct entities, which should have different localized names key = "Property/NonLocalizedPropertyName/Entity/EntityName" value = "LocalizedPropertyName" key = "Property/NonLocalizedPropertyName" value = "LocalizedPropertyName" key = "ErrorString/NonLocalizedErrorString" value = "LocalizedErrorString"
      • setEntitiesForConfiguration

        public void setEntitiesForConfiguration​(NSArray<? extends NSEntityDescription> entities,
                                                java.lang.String configuration)
      • setFetchRequestTemplateForName

        public void setFetchRequestTemplateForName​(NSFetchRequest<?> fetchRequestTemplate,
                                                   java.lang.String name)
        fetch request templates allow to pre-define queries and their parameters in the model (with the tool) - typically they contain variables that need to be substituted at runtime.
      • setLocalizationDictionary

        public void setLocalizationDictionary​(NSDictionary<java.lang.String,​java.lang.String> value)
        NSDictionary containing localized string values for entities, properties, and error strings related to this model. The key and value pattern follows: key = "Entity/NonLocalizedEntityName" value = "LocalizedEntityName" // for properties of the same non-localized name in differenct entities, which should have different localized names key = "Property/NonLocalizedPropertyName/Entity/EntityName" value = "LocalizedPropertyName" key = "Property/NonLocalizedPropertyName" value = "LocalizedPropertyName" key = "ErrorString/NonLocalizedErrorString" value = "LocalizedErrorString"
      • setVersionIdentifiers

        public void setVersionIdentifiers​(NSSet<?> value)
        Returns the collection of developer-defined version identifiers for the model. For models created in Xcode, this value is set by the developer in the model inspector. Merged models return the combined collection of identifiers. This value is meant to be used as a debugging hint to help developers determine the models that were combined to create a merged model. The framework does not give models a default identifier, nor does it depend this value at runtime.
      • versionIdentifiers

        public NSSet<?> versionIdentifiers()
        Returns the collection of developer-defined version identifiers for the model. For models created in Xcode, this value is set by the developer in the model inspector. Merged models return the combined collection of identifiers. This value is meant to be used as a debugging hint to help developers determine the models that were combined to create a merged model. The framework does not give models a default identifier, nor does it depend this value at runtime.