Skip to content

Commit

Permalink
removed deprecated mutator. fixes #70
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Sundin committed Sep 8, 2013
1 parent ba42adc commit 1522dfc
Show file tree
Hide file tree
Showing 13 changed files with 6,557 additions and 6,719 deletions.
6 changes: 1 addition & 5 deletions Source/Factory/Config/Patcher/TyphoonPatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#import <Foundation/Foundation.h>
#import "TyphoonComponentFactoryPostProcessor.h"
#import "TyphoonComponentFactoryMutator.h"

typedef id (^ObjectCreationBlock)();

Expand All @@ -24,10 +23,7 @@ typedef id (^ObjectCreationBlock)();
*
*
*/
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@interface TyphoonPatcher : NSObject <TyphoonComponentFactoryPostProcessor, TyphoonComponentFactoryMutator>
#pragma clang diagnostic pop
@interface TyphoonPatcher : NSObject <TyphoonComponentFactoryPostProcessor>
{
NSMutableDictionary* _patches;
}
Expand Down
8 changes: 0 additions & 8 deletions Source/Factory/Config/Patcher/TyphoonPatcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,6 @@ - (NSArray *)newDefinitionsToRegister
return [newDefinitions copy];
}

- (void)mutateComponentDefinitionsIfRequired:(NSArray *)componentDefinitions
{
for (TyphoonDefinition* definition in componentDefinitions)
{
[self patchDefinitionIfNeeded:definition];
}
}

- (void)patchDefinitionIfNeeded:(TyphoonDefinition*)definition
{
id patchObject = [_patches objectForKey:definition.key];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,10 @@

#import <Foundation/Foundation.h>
#import "TyphoonComponentFactoryPostProcessor.h"
#import "TyphoonComponentFactoryMutator.h"

@protocol TyphoonResource;

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@interface TyphoonPropertyPlaceholderConfigurer : NSObject <TyphoonComponentFactoryPostProcessor, TyphoonComponentFactoryMutator>
#pragma clang diagnostic pop
@interface TyphoonPropertyPlaceholderConfigurer : NSObject <TyphoonComponentFactoryPostProcessor>
{
NSString* _prefix;
NSString* _suffix;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,6 @@ -(void)postProcessComponentFactory:(TyphoonComponentFactory *)factory {
}
}

- (NSArray *)newDefinitionsToRegister
{
return nil;
}

-(void)mutateComponentDefinitionsIfRequired:(NSArray *)componentDefinitions
{
for (TyphoonDefinition* definition in componentDefinitions)
{
for (id <TyphoonComponentInjectedByValue> component in [definition componentsInjectedByValue])
{
[self mutateComponentInjectedByValue:component];
}
}
}

- (void)mutateComponentInjectedByValue:(id <TyphoonComponentInjectedByValue>)component;
{
if ([component.textValue hasPrefix:_prefix] && [component.textValue hasSuffix:_suffix])
Expand Down
25 changes: 0 additions & 25 deletions Source/Factory/Mutator/TyphoonComponentFactoryMutator.h

This file was deleted.

7 changes: 0 additions & 7 deletions Source/Factory/TyphoonComponentFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#import <Foundation/Foundation.h>
#import "TyphoonComponentFactoryPostProcessor.h"
#import "TyphoonComponentFactoryMutator.h"
@class TyphoonDefinition;

/**
Expand All @@ -27,7 +26,6 @@

NSMutableDictionary* _currentlyResolvingReferences;
NSMutableArray* _postProcessors;
NSMutableArray* _mutators;
BOOL _isLoading;
}

Expand Down Expand Up @@ -95,11 +93,6 @@

- (NSArray*)registry;

/**
@deprecated replaced by -attachPostProcessor:
*/
- (void)attachMutator:(id<TyphoonComponentFactoryMutator>)mutator __attribute__((deprecated));

/**
Attach a TyphoonComponentFactoryPostProcessor to this component factory.
@param postProcessor The post-processor to attach.
Expand Down
25 changes: 0 additions & 25 deletions Source/Factory/TyphoonComponentFactory.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ - (id)init
_singletons = [[NSMutableDictionary alloc] init];
_currentlyResolvingReferences = [[NSMutableDictionary alloc] init];
_postProcessors = [[NSMutableArray alloc] init];
_mutators = [[NSMutableArray alloc] init];

}
return self;
Expand Down Expand Up @@ -197,16 +196,6 @@ - (void)attachPostProcessor:(id<TyphoonComponentFactoryPostProcessor>)postProces
[_postProcessors addObject:postProcessor];
}

- (void)attachMutator:(id<TyphoonComponentFactoryMutator>)mutator
{
if ([mutator conformsToProtocol:@protocol(TyphoonComponentFactoryPostProcessor)]) {
[self attachPostProcessor:(id<TyphoonComponentFactoryPostProcessor>)mutator];
} else {
LogTrace(@"Attaching mutator: %@", mutator);
[_mutators addObject:mutator];
}
}

- (void)injectProperties:(id)instance
{
Class class = [instance class];
Expand Down Expand Up @@ -246,20 +235,6 @@ - (BOOL)infrastructureComponentProcessedFromDefinition:(TyphoonDefinition *)defi

- (void)applyComponentFactoryLoadPostProcessing {

// First, we call the mutator on every registered definition.
// To be removed once mutators are fully replaced by post-processors.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[_mutators enumerateObjectsUsingBlock:^(id <TyphoonComponentFactoryMutator> mutator, NSUInteger idx, BOOL* stop)
{
for (TyphoonDefinition* definition in [mutator newDefinitionsToRegister])
{
[self register:definition];
}
[mutator mutateComponentDefinitionsIfRequired:[self registry]];
}];
#pragma clang diagnostic pop

// Apply the factory post processors.
[_postProcessors enumerateObjectsUsingBlock:^(id <TyphoonComponentFactoryPostProcessor> postProcessor, NSUInteger idx, BOOL* stop)
{
Expand Down
1 change: 0 additions & 1 deletion Source/Typhoon.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#import "TyphoonComponentFactory.h"
#import "TyphoonComponentFactory+InstanceBuilder.h"
#import "TyphoonXmlComponentFactory.h"
#import "TyphoonComponentFactoryMutator.h"
#import "TyphoonComponentFactoryPostProcessor.h"
#import "TyphoonRXMLElement+XmlComponentFactory.h"
#import "TyphoonRXMLElement.h"
Expand Down
24 changes: 0 additions & 24 deletions Tests/Factory/TyphoonComponentFactoryTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -207,17 +207,6 @@ - (void)test_able_to_describe_itself
/* ====================================================================================================================================== */
#pragma mark - Infrastructure components

- (void)test_mutator_to_post_processor_migration
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[_componentFactory attachMutator:[[TyphoonPropertyPlaceholderConfigurer alloc] init]];
[_componentFactory attachMutator:[[TyphoonPatcher alloc] init]];
#pragma clang diagnostic pop

assertThatInt([[_componentFactory postProcessors] count], equalToInt(2));
}

- (void)test_post_processor_registration
{
[_componentFactory register:[TyphoonDefinition withClass:[TyphoonComponentFactoryPostProcessorMock class]]];
Expand Down Expand Up @@ -299,19 +288,6 @@ - (void)test_registery_isLoad {
assertThatBool([_componentFactory isLoaded], is(@YES));
}

- (void)test_load_mutators {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
id<TyphoonComponentFactoryMutator> mutator = mockProtocol(@protocol(TyphoonComponentFactoryMutator));
[_componentFactory attachMutator:mutator];
#pragma clang diagnostic pop

[_componentFactory load];
[_componentFactory load]; // Should do nothing
[verifyCount(mutator, times(1)) mutateComponentDefinitionsIfRequired:[_componentFactory registry]];
[verifyCount(mutator, times(1)) newDefinitionsToRegister];
}

- (void)test_load_post_processors {
id<TyphoonComponentFactoryPostProcessor> postProcessor = mockProtocol(@protocol(TyphoonComponentFactoryPostProcessor));
[_componentFactory attachPostProcessor:postProcessor];
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 1522dfc

Please sign in to comment.