Skip to content

Commit

Permalink
GH-96 Add uniquing identifier for Mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Dima Zen committed May 19, 2017
1 parent 5042012 commit 5ff282c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions FastEasyMapping/Source/Mapping/FEMMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ NS_ASSUME_NONNULL_BEGIN
/// CoreData entity name used during CoreData-targeted mapping. It can be nil for NSObject-targeted mappings.
@property (nonatomic, copy, nullable) NSString *entityName;

/// Opaque unique value that is used internally to combine different in-memory instances that describes same Class / Entity.
@property (nonatomic, strong, readonly) NSNumber *uniquingIdentifier;

/**
@brief path to the Object's representation in the JSON. Same as `keyPath` property of the `FEMProperty` protocol.
Expand Down
2 changes: 2 additions & 0 deletions FastEasyMapping/Source/Mapping/FEMMapping.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ - (instancetype)initWithObjectClass:(Class)objectClass {
_relationshipMap = [NSMutableDictionary new];

_objectClass = objectClass;
_uniquingIdentifier = @((NSUInteger)objectClass);
}

return self;
Expand All @@ -41,6 +42,7 @@ - (instancetype)initWithEntityName:(NSString *)entityName {
_relationshipMap = [NSMutableDictionary new];

_entityName = [entityName copy];
_uniquingIdentifier = @(entityName.hash);
}

return self;
Expand Down

0 comments on commit 5ff282c

Please sign in to comment.