Blame view

Pods/Realm/include/RLMProperty.h 3.59 KB
75d24c15   yangbin   123
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
  ////////////////////////////////////////////////////////////////////////////
  //
  // Copyright 2014 Realm Inc.
  //
  // Licensed under the Apache License, Version 2.0 (the "License");
  // you may not use this file except in compliance with the License.
  // You may obtain a copy of the License at
  //
  // http://www.apache.org/licenses/LICENSE-2.0
  //
  // Unless required by applicable law or agreed to in writing, software
  // distributed under the License is distributed on an "AS IS" BASIS,
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  // See the License for the specific language governing permissions and
  // limitations under the License.
  //
  ////////////////////////////////////////////////////////////////////////////
  
  #import <Realm/RLMConstants.h>
  
  NS_ASSUME_NONNULL_BEGIN
  
  /// :nodoc:
  @protocol RLMInt @end
  /// :nodoc:
  @protocol RLMBool @end
  /// :nodoc:
  @protocol RLMDouble @end
  /// :nodoc:
  @protocol RLMFloat @end
  /// :nodoc:
  @protocol RLMString @end
  /// :nodoc:
  @protocol RLMDate @end
  /// :nodoc:
  @protocol RLMData @end
  /// :nodoc:
  @protocol RLMDecimal128 @end
  /// :nodoc:
  @protocol RLMObjectId @end
  /// :nodoc:
  @protocol RLMUUID @end
  
  /// :nodoc:
  @interface NSNumber ()<RLMInt, RLMBool, RLMDouble, RLMFloat>
  @end
  
  /**
   `RLMProperty` instances represent properties managed by a Realm in the context
   of an object schema. Such properties may be persisted to a Realm file or
   computed from other data from the Realm.
  
   When using Realm, `RLMProperty` instances allow performing migrations and
   introspecting the database's schema.
  
   These property instances map to columns in the core database.
   */
  @interface RLMProperty : NSObject
  
  #pragma mark - Properties
  
  /**
   The name of the property.
   */
  @property (nonatomic, readonly) NSString *name;
  
  /**
   The type of the property.
  
   @see `RLMPropertyType`
   */
  @property (nonatomic, readonly) RLMPropertyType type;
  
  /**
   Indicates whether this property is indexed.
  
   @see `RLMObject`
   */
  @property (nonatomic, readonly) BOOL indexed;
  
  /**
   For `RLMObject` and `RLMCollection` properties, the name of the class of object stored in the property.
   */
  @property (nonatomic, readonly, copy, nullable) NSString *objectClassName;
  
  /**
   For linking objects properties, the property name of the property the linking objects property is linked to.
   */
  @property (nonatomic, readonly, copy, nullable) NSString *linkOriginPropertyName;
  
  /**
   Indicates whether this property is optional.
   */
  @property (nonatomic, readonly) BOOL optional;
  
  /**
   Indicates whether this property is an array.
   */
  @property (nonatomic, readonly) BOOL array;
  
  /**
   Indicates whether this property is a set.
   */
  @property (nonatomic, readonly) BOOL set;
  
  /**
   Indicates whether this property is a dictionary.
   */
  @property (nonatomic, readonly) BOOL dictionary;
  
  /**
   Indicates whether this property is an array or set.
   */
  @property (nonatomic, readonly) BOOL collection;
  
  #pragma mark - Methods
  
  /**
   Returns whether a given property object is equal to the receiver.
   */
  - (BOOL)isEqualToProperty:(RLMProperty *)property;
  
  @end
  
  
  /**
   An `RLMPropertyDescriptor` instance represents a specific property on a given class.
   */
  @interface RLMPropertyDescriptor : NSObject
  
  /**
   Creates and returns a property descriptor.
  
   @param objectClass  The class of this property descriptor.
   @param propertyName The name of this property descriptor.
   */
  + (instancetype)descriptorWithClass:(Class)objectClass propertyName:(NSString *)propertyName;
  
  /// The class of the property.
  @property (nonatomic, readonly) Class objectClass;
  
  /// The name of the property.
  @property (nonatomic, readonly) NSString *propertyName;
  
  @end
  
  NS_ASSUME_NONNULL_END