1 ////////////////////////////////////////////////////////////////////////////
3 // Copyright 2014 Realm Inc.
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
17 ////////////////////////////////////////////////////////////////////////////
19 #import <Realm/RLMConstants.h>
21 NS_ASSUME_NONNULL_BEGIN
26 @protocol RLMBool @end
28 @protocol RLMDouble @end
30 @protocol RLMFloat @end
32 @protocol RLMString @end
34 @protocol RLMDate @end
36 @protocol RLMData @end
39 @interface NSNumber ()<RLMInt, RLMBool, RLMDouble, RLMFloat>
43 `RLMProperty` instances represent properties managed by a Realm in the context
44 of an object schema. Such properties may be persisted to a Realm file or
45 computed from other data from the Realm.
47 When using Realm, `RLMProperty` instances allow performing migrations and
48 introspecting the database's schema.
50 These property instances map to columns in the core database.
52 @interface RLMProperty : NSObject
54 #pragma mark - Properties
57 The name of the property.
59 @property (nonatomic, readonly) NSString *name;
62 The type of the property.
64 @see `RLMPropertyType`
66 @property (nonatomic, readonly) RLMPropertyType type;
69 Indicates whether this property is indexed.
73 @property (nonatomic, readonly) BOOL indexed;
76 For `RLMObject` and `RLMArray` properties, the name of the class of object stored in the property.
78 @property (nonatomic, readonly, copy, nullable) NSString *objectClassName;
81 For linking objects properties, the property name of the property the linking objects property is linked to.
83 @property (nonatomic, readonly, copy, nullable) NSString *linkOriginPropertyName;
86 Indicates whether this property is optional.
88 @property (nonatomic, readonly) BOOL optional;
91 Indicates whether this property is an array.
93 @property (nonatomic, readonly) BOOL array;
95 #pragma mark - Methods
98 Returns whether a given property object is equal to the receiver.
100 - (BOOL)isEqualToProperty:(RLMProperty *)property;
106 An `RLMPropertyDescriptor` instance represents a specific property on a given class.
108 @interface RLMPropertyDescriptor : NSObject
111 Creates and returns a property descriptor.
113 @param objectClass The class of this property descriptor.
114 @param propertyName The name of this property descriptor.
116 + (instancetype)descriptorWithClass:(Class)objectClass propertyName:(NSString *)propertyName;
118 /// The class of the property.
119 @property (nonatomic, readonly) Class objectClass;
121 /// The name of the property.
122 @property (nonatomic, readonly) NSString *propertyName;
126 NS_ASSUME_NONNULL_END