RBManagedJsonObject Class Reference
Inherits from | RBIntrospectiveObject : NSObject |
---|---|
Declared in | RBManagedJsonObject.h |
Overview
A class of properties that provides built in JSON
serialisation.
Note: Collection properties cannot contain elements of mixed types.
+ arrayMappings
Gets a dictionary of the names of NSArray
properties to the Class
type of their elements.
+ (nullable NSDictionary<NSString*,Class> *)arrayMappings
Return Value
The dictionary of Class
types to property names.
Declared In
RBManagedJsonObject.h
+ dictionaryMappings
Gets a dictionary of the names of NSDictionary
properties to the Class
type of their values.
+ (nullable NSDictionary<NSString*,Class> *)dictionaryMappings
Return Value
The dictionary of Class
types to property names.
Declared In
RBManagedJsonObject.h
– jsonKeyForPropertyName:
Gets the JSON
key that should be used for the given property name.
- (nonnull NSString *)jsonKeyForPropertyName:(nonnull NSString *)propertyName
Parameters
propertyName |
The name of the property on the class. |
---|
Return Value
The key string that will be used in JSON
serialisation.
Declared In
RBManagedJsonObject.h
– convertDateToString:propertyName:
Serialise the given NSDate
property value to a string.
- (nonnull NSString *)convertDateToString:(nonnull NSDate *)date propertyName:(nonnull NSString *)propertyName
Parameters
date |
The |
---|---|
propertyName |
The name of the property. |
Return Value
The resulting NSString
object.
Declared In
RBManagedJsonObject.h
– convertStringToDate:propertyName:
Deserialise a date string to an NSDate
property.
- (nullable NSDate *)convertStringToDate:(nonnull NSString *)dateString propertyName:(nonnull NSString *)propertyName
Parameters
dateString |
The serialised string value. |
---|---|
propertyName |
The name of the property. |
Return Value
The resulting NSDate
object.
Declared In
RBManagedJsonObject.h
– initWithDictionary:
Initialize the managed JSON
object with the given property list dictionary.
- (nonnull instancetype)initWithDictionary:(nonnull NSDictionary<NSString*,id> *)dictionary
Parameters
dictionary |
The property list |
---|
Return Value
The initialized object.
Declared In
RBManagedJsonObject.h
– dictionary
Serialises the value of the object to a property list NSDictionary
.
The result includes recursively the values of it’s children.
- (nonnull NSDictionary<NSString*,id> *)dictionary
Return Value
The resulting property list NSDictionary
object.
Declared In
RBManagedJsonObject.h
– data
Serialises the value of the object to NSData
containing the JSON
representation of the object.
The result includes recursively the values of it’s children.
- (nonnull NSData *)data
Return Value
The resulting JSON
as a NSData
.
Declared In
RBManagedJsonObject.h
– string
Serialises the value of the object to a JSON
string.
The result includes recursively the values of it’s children.
- (nonnull NSString *)string
Return Value
The resulting json string.
Declared In
RBManagedJsonObject.h
+ objectFromJsonData:error:
Builds an object by deserialising the given JSON
data.
+ (nullable instancetype)objectFromJsonData:(nonnull NSData *)jsonData error:(NSError *_Nullable *_Nullable)error
Parameters
jsonData |
The |
---|---|
error |
An |
Return Value
The deserialised object, or nil
if it could not be deserialised.
Declared In
RBManagedJsonObject.h
+ objectFromJsonString:error:
Builds an object by deserialising the given JSON
string.
+ (nullable instancetype)objectFromJsonString:(nonnull NSString *)jsonString error:(NSError *_Nullable *_Nullable)error
Parameters
jsonString |
The |
---|---|
error |
An |
Return Value
The deserialised object, or nil
if it could not be deserialised.
Declared In
RBManagedJsonObject.h
+ objectsFromJsonData:error:
Builds an array of objects by deserialising the given JSON
data.
+ (nullable NSArray *)objectsFromJsonData:(nonnull NSData *)jsonData error:(NSError *_Nullable *_Nullable)error
Parameters
jsonData |
The |
---|---|
error |
An |
Return Value
The deserialised object, or nil
if it could not be deserialised.
Declared In
RBManagedJsonObject.h
+ objectsFromJsonString:error:
Builds an array of objects by deserialising the given JSON
string.
+ (nullable NSArray *)objectsFromJsonString:(nonnull NSString *)jsonString error:(NSError *_Nullable *_Nullable)error
Parameters
jsonString |
The |
---|---|
error |
An |
Return Value
The deserialised object, or nil
if it could not be deserialised.
Declared In
RBManagedJsonObject.h