2016-03-12 10:01:53 +00:00
|
|
|
#import "SWGName.h"
|
|
|
|
|
|
|
|
@implementation SWGName
|
|
|
|
|
|
|
|
- (instancetype)init {
|
|
|
|
self = [super init];
|
|
|
|
|
|
|
|
if (self) {
|
|
|
|
// initalise property's default value, if any
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps json key to property name.
|
|
|
|
* This method is used by `JSONModel`.
|
|
|
|
*/
|
|
|
|
+ (JSONKeyMapper *)keyMapper
|
|
|
|
{
|
2016-03-22 10:56:56 +00:00
|
|
|
return [[JSONKeyMapper alloc] initWithDictionary:@{ @"name": @"name", @"snake_case": @"snakeCase" }];
|
2016-03-12 10:01:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates whether the property with the given name is optional.
|
|
|
|
* If `propertyName` is optional, then return `YES`, otherwise return `NO`.
|
|
|
|
* This method is used by `JSONModel`.
|
|
|
|
*/
|
|
|
|
+ (BOOL)propertyIsOptional:(NSString *)propertyName
|
|
|
|
{
|
2016-04-10 11:34:09 +00:00
|
|
|
NSArray *optionalProperties = @[@"snakeCase"];
|
2016-03-12 10:01:53 +00:00
|
|
|
|
|
|
|
if ([optionalProperties containsObject:propertyName]) {
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the string presentation of the object.
|
|
|
|
* This method will be called when logging model object using `NSLog`.
|
|
|
|
*/
|
|
|
|
- (NSString *)description {
|
|
|
|
return [[self toDictionary] description];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|