MapsIndoors iOS SDK
V3
|
#import <MPJSONValueTransformer.h>
Inherits NSObject.
Instance Methods | |
Transforming to Mutable copies | |
(NSMutableString *) | - NSMutableStringFromNSString: |
(NSMutableArray *) | - NSMutableArrayFromNSArray: |
(NSMutableDictionary *) | - NSMutableDictionaryFromNSDictionary: |
Transforming Sets | |
(NSSet *) | - NSSetFromNSArray: |
(NSMutableSet *) | - NSMutableSetFromNSArray: |
(NSArray *) | - JSONObjectFromNSSet: |
(NSArray *) | - JSONObjectFromNSMutableSet: |
Transforming JSON types | |
(NSNumber *) | - BOOLFromNSNumber: |
(NSNumber *) | - BOOLFromNSString: |
(NSNumber *) | - JSONObjectFromBOOL: |
(NSNumber *) | - NSNumberFromNSString: |
(NSString *) | - NSStringFromNSNumber: |
(NSDecimalNumber *) | - NSDecimalNumberFromNSString: |
(NSString *) | - NSStringFromNSDecimalNumber: |
Transforming URLs | |
(NSURL *) | - NSURLFromNSString: |
(NSString *) | - JSONObjectFromNSURL: |
Transforming NSTimeZone | |
(NSTimeZone *) | - NSTimeZoneFromNSString: |
(NSString *) | - JSONObjectFromNSTimeZone: |
Transforming Dates | |
(NSDate *) | - NSDateFromNSNumber: |
Class Methods | |
Resolving cluster class names | |
(Class) | + classByResolvingClusterClasses: |
You don't need to call methods of this class manually.
Class providing methods to transform values from one class to another. You are given a number of built-in transformers, but you are encouraged to extend this class with your own categories to add further value transformers. Just few examples of what can you add to MPJSONValueTransformer: hex colors in JSON to UIColor, hex numbers in JSON to NSNumber model properties, base64 encoded strings in JSON to UIImage properties, and more.
The class is invoked by MPJSONModel while transforming incoming JSON types into your target class property classes, and vice versa. One static copy is create and store in the MPJSONModel class scope.
- (NSNumber *) BOOLFromNSNumber: | (NSNumber *) | number |
Transforms a number object to a bool number object
number | the number to convert |
- (NSNumber *) BOOLFromNSString: | (NSString *) | string |
Transforms a number object to a bool number object
string | the string value to convert, "0" converts to NO, everything else to YES |
+ (Class) classByResolvingClusterClasses: | (Class) | sourceClass |
This method returns the umbrella class for any standard class cluster members. For example returns NSString when given as input NSString, NSMutableString, __CFString and __CFConstantString The method currently looksup a pre-defined list.
sourceClass | the class to get the umbrella class for |
- (NSNumber *) JSONObjectFromBOOL: | (NSNumber *) | number |
Transforms a BOOL value to a bool number object
number | an NSNumber value coming from the model |
- (NSArray *) JSONObjectFromNSMutableSet: | (NSMutableSet *) | set |
Transforms a mutable set to an array
set | incoming mutable set |
- (NSArray *) JSONObjectFromNSSet: | (NSSet *) | set |
Transforms a set to an array
set | incoming set |
- (NSString *) JSONObjectFromNSTimeZone: | (NSTimeZone *) | timeZone |
Transforms an NSTimeZone object to a string
timeZone | the time zone object to convert |
- (NSString *) JSONObjectFromNSURL: | (NSURL *) | url |
Transforms an NSURL object to a string
url | the url object to convert |
- (NSDate *) NSDateFromNSNumber: | (NSNumber *) | number |
The following two methods are not public. This way if there is a category on converting dates it'll override them. If there isn't a category the default methods found in the .m file will be invoked. If these are public a warning is produced at the point of overriding them in a category, so they have to stay hidden here. Transforms a number to an NSDate object
number | the number to convert |
- (NSDecimalNumber *) NSDecimalNumberFromNSString: | (NSString *) | string |
Transforms a string object to a nsdecimalnumber object
string | the string to convert |
- (NSMutableArray *) NSMutableArrayFromNSArray: | (NSArray *) | array |
Transforms an array to a mutable array
array | incoming array |
- (NSMutableDictionary *) NSMutableDictionaryFromNSDictionary: | (NSDictionary *) | dict |
Transforms a dictionary to a mutable dictionary
dict | incoming dictionary |
- (NSMutableSet *) NSMutableSetFromNSArray: | (NSArray *) | array |
Transforms an array to a mutable set
array | incoming array |
- (NSMutableString *) NSMutableStringFromNSString: | (NSString *) | string |
Transforms a string value to a mutable string value
string | incoming string |
- (NSNumber *) NSNumberFromNSString: | (NSString *) | string |
Transforms a string object to a number object
string | the string to convert |
- (NSSet *) NSSetFromNSArray: | (NSArray *) | array |
Transforms an array to a set
array | incoming array |
- (NSString *) NSStringFromNSDecimalNumber: | (NSDecimalNumber *) | number |
Transforms a nsdecimalnumber object to a string object
number | the number to convert |
- (NSString *) NSStringFromNSNumber: | (NSNumber *) | number |
Transforms a number object to a string object
number | the number to convert |
- (NSTimeZone *) NSTimeZoneFromNSString: | (NSString *) | string |
Transforms a string object to an NSTimeZone object
string | the string to convert |
- (NSURL *) NSURLFromNSString: | (NSString *) | string |
Transforms a string object to an NSURL object
string | the string to convert |