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.

Discussion

Gets a dictionary of the names of NSArray properties to the Class type of their elements.

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.

Discussion

Gets a dictionary of the names of NSDictionary properties to the Class type of their values.

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.

Discussion

Gets the JSON key that should be used for the given property name.

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 NSDate property value.

propertyName

The name of the property.

Return Value

The resulting NSString object.

Discussion

Serialise the given NSDate property value to a string.

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.

Discussion

Deserialise a date string to an NSDate property.

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 NSDictionary object.

Return Value

The initialized object.

Discussion

Initialize the managed JSON object with the given property list dictionary.

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.

Discussion

Serialises the value of the object to a property list NSDictionary. The result includes recursively the values of it’s children.

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 JSON data to deserialise.

error

An NSError pointer that will be assigned if there is an error.

Return Value

The deserialised object, or nil if it could not be deserialised.

Discussion

Builds an object by deserialising the given JSON data.

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 JSON data to deserialise.

error

An NSError pointer that will be assigned if there is an error.

Return Value

The deserialised object, or nil if it could not be deserialised.

Discussion

Builds an array of objects by deserialising the given JSON data.

Declared In

RBManagedJsonObject.h