Skip to content

Commit

Permalink
Merge pull request #369 from radianttap/usescustomattributetype
Browse files Browse the repository at this point in the history
Expose information when custom type is set through userInfo. Thanks!
  • Loading branch information
atomicbird authored Jul 22, 2018
2 parents c14efdd + 1930cd9 commit 7214f07
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mogenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@
@interface NSAttributeDescription (typing)
- (BOOL)hasScalarAttributeType;
- (BOOL)usesScalarAttributeType;
- (BOOL)usesCustomScalarAttributeType;
- (NSString*)scalarAttributeType;
- (NSString*)scalarAccessorMethodName;
- (NSString*)scalarFactoryMethodName;
- (BOOL)hasDefinedAttributeType;
- (NSArray*)objectAttributeTransformableProtocols;
- (BOOL)hasAttributeTransformableProtocols;
- (BOOL)usesCustomObjectAttributeType;
- (NSString*)objectAttributeClassName;
- (NSString*)objectAttributeType;
- (BOOL)hasTransformableAttributeType;
Expand Down
11 changes: 11 additions & 0 deletions mogenerator.m
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,11 @@ - (BOOL)usesScalarAttributeType {
}
}

- (BOOL)usesCustomScalarAttributeType {
NSString *attributeValueScalarType = [[self userInfo] objectForKey:kAttributeValueScalarTypeKey];
return (attributeValueScalarType != nil);
}

- (NSString*)scalarAttributeType {
BOOL isUnsigned = [self isUnsigned];

Expand Down Expand Up @@ -603,6 +608,12 @@ - (NSArray*)objectAttributeTransformableProtocols {
- (BOOL)hasAttributeTransformableProtocols {
return [self hasTransformableAttributeType] && [[self userInfo] objectForKey:@"attributeTransformableProtocols"];
}

- (BOOL)usesCustomObjectAttributeType {
NSString *attributeValueClassName = [[self userInfo] objectForKey:@"attributeValueClassName"];
return (attributeValueClassName != nil);
}

- (NSString*)objectAttributeType {
NSString *result = [self objectAttributeClassName];
if ([result isEqualToString:@"Class"]) {
Expand Down

0 comments on commit 7214f07

Please sign in to comment.