Files
RestKit/Code/ObjectMapping/RKPropertyMapping.m
Blake Watters d926e240f8 Introduce RKPropertyMapping abstract superclass for RKAttributeMapping and RKRelationshipMapping.
Add primitives for working with attribute, relationship, and property mapping objects.
2012-08-28 14:14:20 -04:00

39 lines
1.0 KiB
Objective-C

//
// RKPropertyMapping.m
// RestKit
//
// Created by Blake Watters on 8/27/12.
// Copyright (c) 2012 RestKit. All rights reserved.
//
#import "RKPropertyMapping.h"
@interface RKPropertyMapping ()
@property (nonatomic, strong, readwrite) NSString *sourceKeyPath;
@property (nonatomic, strong, readwrite) NSString *destinationKeyPath;
@end
@implementation RKPropertyMapping
- (id)copyWithZone:(NSZone *)zone
{
RKPropertyMapping *copy = [[[self class] allocWithZone:zone] init];
copy.sourceKeyPath = self.sourceKeyPath;
copy.destinationKeyPath = self.destinationKeyPath;
return copy;
}
- (BOOL)isEqualToMapping:(RKPropertyMapping *)otherMapping
{
return [otherMapping isMemberOfClass:[self class]] &&
[self.sourceKeyPath isEqual:otherMapping.sourceKeyPath] &&
[self.destinationKeyPath isEqual:otherMapping.destinationKeyPath];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"<%@: %p %@ => %@>", self.class, self, self.sourceKeyPath, self.destinationKeyPath];
}
@end