From 6f9c4094719e152834f8e1b8767759d91ed39ff6 Mon Sep 17 00:00:00 2001 From: Jasper Blues Date: Sun, 20 Jan 2013 17:16:31 +0800 Subject: [PATCH] Rename to Typhoon! --- README.md | 28 +-- Source/.DS_Store | Bin 0 -> 6148 bytes ...alizer.h => TyphoonComponentInitializer.h} | 20 +-- ...alizer.m => TyphoonComponentInitializer.m} | 32 ++-- ...Parameter.h => TyphoonInjectedParameter.h} | 14 +- ... => TyphoonParameterInjectedByReference.h} | 6 +- ... => TyphoonParameterInjectedByReference.m} | 12 +- ...ue.h => TyphoonParameterInjectedByValue.h} | 12 +- ...ue.m => TyphoonParameterInjectedByValue.m} | 22 +-- ...edProperty.h => TyphoonInjectedProperty.h} | 16 +- ...h => TyphoonPropertyInjectedByReference.h} | 6 +- ...m => TyphoonPropertyInjectedByReference.m} | 8 +- ...Type.h => TyphoonPropertyInjectedByType.h} | 6 +- ...Type.m => TyphoonPropertyInjectedByType.m} | 8 +- ...lue.h => TyphoonPropertyInjectedByValue.h} | 6 +- ...lue.m => TyphoonPropertyInjectedByValue.m} | 8 +- ...e.h => TyphoonPropertyInjectionDelegate.h} | 2 +- .../SpringComponentDefinition+BlockBuilders.h | 59 ------- .../SpringComponentDefinition+BlockBuilders.m | 89 ---------- ...TyphoonComponentDefinition+BlockBuilders.h | 60 +++++++ ...TyphoonComponentDefinition+BlockBuilders.m | 89 ++++++++++ ...inition.h => TyphoonComponentDefinition.h} | 24 +-- ...inition.m => TyphoonComponentDefinition.m} | 59 ++++--- ...tor.h => TyphoonComponentFactoryMutator.h} | 9 +- ...=> TyphoonPropertyPlaceholderConfigurer.h} | 17 +- ...=> TyphoonPropertyPlaceholderConfigurer.m} | 29 ++-- ...TyphoonComponentFactory+InstanceBuilder.h} | 6 +- ...TyphoonComponentFactory+InstanceBuilder.m} | 90 +++++----- ...entFactory.h => TyphoonComponentFactory.h} | 18 +- ...entFactory.m => TyphoonComponentFactory.m} | 50 +++--- ... TyphoonRXMLElement+XmlComponentFactory.h} | 18 +- ... TyphoonRXMLElement+XmlComponentFactory.m} | 58 +++---- ...ringRXMLElement.h => TyphoonRXMLElement.h} | 16 +- ...ringRXMLElement.m => TyphoonRXMLElement.m} | 44 ++--- ...Factory.h => TyphoonXmlComponentFactory.h} | 4 +- ...Factory.m => TyphoonXmlComponentFactory.m} | 14 +- Source/Info-iOS.plist | 28 +++ Source/Spring.h | 26 --- Source/Swizzle/.DS_Store | Bin 0 -> 6148 bytes Source/Swizzle/JRSwizzle.h | 13 ++ Source/Swizzle/JRSwizzle.m | 134 +++++++++++++++ ...gTypeConverter.h => TyphonTypeConverter.h} | 4 +- ...onverter.h => TyphoonNSURLTypeConverter.h} | 4 +- ...onverter.m => TyphoonNSURLTypeConverter.m} | 4 +- ...er.h => TyphoonPassThroughTypeConverter.h} | 4 +- ...er.m => TyphoonPassThroughTypeConverter.m} | 6 +- ...rter.h => TyphoonPrimitiveTypeConverter.h} | 6 +- ...rter.m => TyphoonPrimitiveTypeConverter.m} | 48 +++--- ...istry.h => TyphoonTypeConverterRegistry.h} | 18 +- ...istry.m => TyphoonTypeConverterRegistry.m} | 34 ++-- ...peDescriptor.h => TyphoonTypeDescriptor.h} | 52 +++--- ...peDescriptor.m => TyphoonTypeDescriptor.m} | 32 ++-- Source/Typhoon.h | 27 +++ ...ing-Objective-C-Prefix.pch => Typhoon.pch} | 0 ...h => NSObject+TyphoonIntrospectionUtils.h} | 10 +- ...m => NSObject+TyphoonIntrospectionUtils.m} | 14 +- ...ndleResource.h => TyphoonBundleResource.h} | 6 +- ...ndleResource.m => TyphoonBundleResource.m} | 6 +- .../{SpringResource.h => TyphoonResource.h} | 2 +- ...ionUtils.h => TyphoonIntrospectionUtils.h} | 2 +- ...ionUtils.m => TyphoonIntrospectionUtils.m} | 4 +- ...bject.h => TyphoonIntrospectiveNSObject.h} | 6 +- .../{SpringTestUtils.h => TyphoonTestUtils.h} | 0 ...ts.m => TyphoonComponentDefinitionTests.m} | 12 +- ...phoonPropertyPlaceholderConfigurerTests.m} | 16 +- Tests/Factory/SpringComponentFactoryTests.m | 161 ------------------ ...onComponentFactory+InstanceBuilderTests.m} | 42 ++--- Tests/Factory/TyphoonComponentFactoryTests.m | 161 ++++++++++++++++++ ...=> RXMLElement+XmlComponentFactoryTests.m} | 12 +- ...ts.m => TyphoonXmlComponentFactoryTests.m} | 32 ++-- Tests/JuicyTests-Prefix.pch | 2 +- Tests/Model/CavalryMan.h | 4 +- .../CircularDependenciesAssembly.xml | 4 +- Tests/Resources/ExceptionTestAssembly.xml | 6 +- Tests/Resources/MiddleAgesAssembly.xml | 4 +- .../Resources/PropertyPlaceholderAssembly.xml | 4 +- ...m => TyphoonPrimitiveTypeConverterTests.m} | 22 +-- ....m => TyphoonTypeConverterRegistryTests.m} | 24 +-- ...NSObject+TyphoonIntrospectionUtilsTests.m} | 32 ++-- build-configuration.properties | 4 +- build.xml | 14 +- schema/assembly.xsd | 12 +- 82 files changed, 1098 insertions(+), 919 deletions(-) create mode 100644 Source/.DS_Store rename Source/Component/Initializer/{SpringComponentInitializer.h => TyphoonComponentInitializer.h} (65%) rename Source/Component/Initializer/{SpringComponentInitializer.m => TyphoonComponentInitializer.m} (81%) rename Source/Component/Initializer/{SpringInjectedParameter.h => TyphoonInjectedParameter.h} (61%) rename Source/Component/Initializer/{SpringParameterInjectedByReference.h => TyphoonParameterInjectedByReference.h} (77%) rename Source/Component/Initializer/{SpringParameterInjectedByReference.m => TyphoonParameterInjectedByReference.m} (82%) rename Source/Component/Initializer/{SpringParameterInjectedByValue.h => TyphoonParameterInjectedByValue.h} (73%) rename Source/Component/Initializer/{SpringParameterInjectedByValue.m => TyphoonParameterInjectedByValue.m} (79%) rename Source/Component/Properties/{SpringInjectedProperty.h => TyphoonInjectedProperty.h} (60%) rename Source/Component/Properties/{SpringPropertyInjectedByReference.h => TyphoonPropertyInjectedByReference.h} (78%) rename Source/Component/Properties/{SpringPropertyInjectedByReference.m => TyphoonPropertyInjectedByReference.m} (88%) rename Source/Component/Properties/{SpringPropertyInjectedByType.h => TyphoonPropertyInjectedByType.h} (75%) rename Source/Component/Properties/{SpringPropertyInjectedByType.m => TyphoonPropertyInjectedByType.m} (82%) rename Source/Component/Properties/{SpringPropertyInjectedByValue.h => TyphoonPropertyInjectedByValue.h} (78%) rename Source/Component/Properties/{SpringPropertyInjectedByValue.m => TyphoonPropertyInjectedByValue.m} (88%) rename Source/Component/Properties/{SpringPropertyInjectionDelegate.h => TyphoonPropertyInjectionDelegate.h} (90%) delete mode 100644 Source/Component/SpringComponentDefinition+BlockBuilders.h delete mode 100644 Source/Component/SpringComponentDefinition+BlockBuilders.m create mode 100644 Source/Component/TyphoonComponentDefinition+BlockBuilders.h create mode 100644 Source/Component/TyphoonComponentDefinition+BlockBuilders.m rename Source/Component/{SpringComponentDefinition.h => TyphoonComponentDefinition.h} (66%) rename Source/Component/{SpringComponentDefinition.m => TyphoonComponentDefinition.m} (61%) rename Source/Factory/Mutator/{SpringComponentFactoryMutator.h => TyphoonComponentFactoryMutator.h} (72%) rename Source/Factory/PropertyConfigurers/{SpringPropertyPlaceholderConfigurer.h => TyphoonPropertyPlaceholderConfigurer.h} (56%) rename Source/Factory/PropertyConfigurers/{SpringPropertyPlaceholderConfigurer.m => TyphoonPropertyPlaceholderConfigurer.m} (76%) rename Source/Factory/{SpringComponentFactory+InstanceBuilder.h => TyphoonComponentFactory+InstanceBuilder.h} (73%) rename Source/Factory/{SpringComponentFactory+InstanceBuilder.m => TyphoonComponentFactory+InstanceBuilder.m} (55%) rename Source/Factory/{SpringComponentFactory.h => TyphoonComponentFactory.h} (76%) rename Source/Factory/{SpringComponentFactory.m => TyphoonComponentFactory.m} (79%) rename Source/Factory/Xml/{SpringRXMLElement+SpringXmlComponentFactory.h => TyphoonRXMLElement+XmlComponentFactory.h} (54%) rename Source/Factory/Xml/{SpringRXMLElement+SpringXmlComponentFactory.m => TyphoonRXMLElement+XmlComponentFactory.m} (70%) rename Source/Factory/Xml/{SpringRXMLElement.h => TyphoonRXMLElement.h} (89%) rename Source/Factory/Xml/{SpringRXMLElement.m => TyphoonRXMLElement.m} (89%) rename Source/Factory/Xml/{SpringXmlComponentFactory.h => TyphoonXmlComponentFactory.h} (86%) rename Source/Factory/Xml/{SpringXmlComponentFactory.m => TyphoonXmlComponentFactory.m} (78%) create mode 100644 Source/Info-iOS.plist delete mode 100644 Source/Spring.h create mode 100644 Source/Swizzle/.DS_Store create mode 100644 Source/Swizzle/JRSwizzle.h create mode 100644 Source/Swizzle/JRSwizzle.m rename Source/TypeConversion/{SpringTypeConverter.h => TyphonTypeConverter.h} (89%) rename Source/TypeConversion/{SpringNSURLTypeConverter.h => TyphoonNSURLTypeConverter.h} (81%) rename Source/TypeConversion/{SpringNSURLTypeConverter.m => TyphoonNSURLTypeConverter.m} (86%) rename Source/TypeConversion/{SpringPassThroughTypeConverter.h => TyphoonPassThroughTypeConverter.h} (84%) rename Source/TypeConversion/{SpringPassThroughTypeConverter.m => TyphoonPassThroughTypeConverter.m} (89%) rename Source/TypeConversion/{SpringPrimitiveTypeConverter.h => TyphoonPrimitiveTypeConverter.h} (71%) rename Source/TypeConversion/{SpringPrimitiveTypeConverter.m => TyphoonPrimitiveTypeConverter.m} (67%) rename Source/TypeConversion/{SpringTypeConverterRegistry.h => TyphoonTypeConverterRegistry.h} (69%) rename Source/TypeConversion/{SpringTypeConverterRegistry.m => TyphoonTypeConverterRegistry.m} (65%) rename Source/TypeConversion/{SpringTypeDescriptor.h => TyphoonTypeDescriptor.h} (53%) rename Source/TypeConversion/{SpringTypeDescriptor.m => TyphoonTypeDescriptor.m} (74%) create mode 100644 Source/Typhoon.h rename Source/{Spring-Objective-C-Prefix.pch => Typhoon.pch} (100%) rename Source/Utils/{NSObject+SpringIntrospectionUtils.h => NSObject+TyphoonIntrospectionUtils.h} (69%) rename Source/Utils/{NSObject+SpringIntrospectionUtils.m => NSObject+TyphoonIntrospectionUtils.m} (85%) rename Source/Utils/Resource/{SpringBundleResource.h => TyphoonBundleResource.h} (81%) rename Source/Utils/Resource/{SpringBundleResource.m => TyphoonBundleResource.m} (93%) rename Source/Utils/Resource/{SpringResource.h => TyphoonResource.h} (93%) rename Source/Utils/{SpringIntrospectionUtils.h => TyphoonIntrospectionUtils.h} (92%) rename Source/Utils/{SpringIntrospectionUtils.m => TyphoonIntrospectionUtils.m} (93%) rename Source/Utils/{SpringIntrospectiveNSObject.h => TyphoonIntrospectiveNSObject.h} (76%) rename Source/Utils/{SpringTestUtils.h => TyphoonTestUtils.h} (100%) rename Tests/Component/{SpringComponentDefinitionTests.m => TyphoonComponentDefinitionTests.m} (74%) rename Tests/Factory/Mutator/PropertyConfigurer/{SpringPropertyPlaceholderConfigurerTests.m => TyphoonPropertyPlaceholderConfigurerTests.m} (63%) delete mode 100644 Tests/Factory/SpringComponentFactoryTests.m rename Tests/Factory/{SpringComponentFactory+InstanceBuilderTests.m => TyphoonComponentFactory+InstanceBuilderTests.m} (69%) create mode 100644 Tests/Factory/TyphoonComponentFactoryTests.m rename Tests/Factory/Xml/{RXMLElement+SpringXmlComponentFactoryTests.m => RXMLElement+XmlComponentFactoryTests.m} (72%) rename Tests/Factory/Xml/{SpringXmlComponentFactoryTests.m => TyphoonXmlComponentFactoryTests.m} (75%) rename Tests/TypeConversion/{SpringPrimitiveTypeConverterTests.m => TyphoonPrimitiveTypeConverterTests.m} (75%) rename Tests/TypeConversion/{SpringTypeConverterRegistryTests.m => TyphoonTypeConverterRegistryTests.m} (63%) rename Tests/Utils/{NSObject+SpringReflectionUtilsTests.m => NSObject+TyphoonIntrospectionUtilsTests.m} (70%) diff --git a/README.md b/README.md index 3b07f4cf6..27334967a 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,12 @@ A Spring-like dependency injection container for Objective-C and Cocoa. Light-w ## Status? It's ready to use! -* Try the sample application. +* Try the sample application. ##Current Work? * More AppCode IDE integration. (Thanks to Jetbrains for the assistance). -* A very cool block-based application assembly, for those that prefer pure-code. (Mostly done, just need to do the docs). +* A very cool block-based application assembly, for those that prefer pure-code. (Mostly done, just need to do the docs). * Macro-style injection * A super-secret new name! @@ -142,31 +142,31 @@ and GUI tool-support. * If you're interested in reading an architectural discussion, especially ___why xml is a good choice___ to declare components, their collaborating classes and their configurations, as well as what other styles of dependency injection this container will be supporting: -___then please read this.___ +___then please read this.___ otherwise . . . # Usage -* Play with the sample application. +* Play with the sample application. And then: -* Assembling Components in XML ___or___ Assembling Components with Blocks +* Assembling Components in XML ___or___ Assembling Components with Blocks -* Using Assembled Components +* Using Assembled Components -* Incorporating the framework into your project. +* Incorporating the framework into your project. -* Configuration Management & Testing. +* Configuration Management & Testing. # Reports In the spirit of lean-methodologies, the API and Test Coverage reports below are published by my build server, after each commit. (If you'd like the script I will share it). -* API -* Coverage Reports +* API +* Coverage Reports @@ -174,13 +174,13 @@ each commit. (If you'd like the script I will share it). . . . are very welcome. -* Contribution Guide. +* Contribution Guide. -* Look at, and contribute to the roadmap here. +* Look at, and contribute to the roadmap here. # Frequently Asked Questions -. . . are here. +. . . are here. # Who's using it? @@ -192,7 +192,7 @@ each commit. (If you'd like the script I will share it). # Authors -* Jasper Blues - jasper@appsquick.ly +* Jasper Blues - jasper@appsquick.ly ### With contributions from: diff --git a/Source/.DS_Store b/Source/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..4cd2177df7545faf9351ca671199ff53eecf1e76 GIT binary patch literal 6148 zcmeHK&2G~`5T4Bsv1zGtsnnyzi9?$!p_>k1k$R8w5c;w9J_`Ej z;8}fbI=!{G?(A;w%+{T0v$?a2#@@}@%(g7M{?S^!-nf0Q=f0V}eV1Wr5QYmu$~BGW z@E%HG>1W+I3VC!2i(su#k0#g}UmnXyZiU#^02>kI)5N~P|Kh>4HFp4CahMx4$TLcl z0%K{8F~n9ESmkPgRmE{j5m87f+w1bDte2or9}arDeg zf1xlrJNg~zPOPQS)FuNa1NjV;RkJSc|2x0`{?C(4%VfZ0;J?ZMs~mI>+E|jlTjv%h w?pg=sIf@YBmnoDKRQfuWinxl`P^7@-2nE>Em?=aL#QYJEX)u+^z+cV44`spNp#T5? literal 0 HcmV?d00001 diff --git a/Source/Component/Initializer/SpringComponentInitializer.h b/Source/Component/Initializer/TyphoonComponentInitializer.h similarity index 65% rename from Source/Component/Initializer/SpringComponentInitializer.h rename to Source/Component/Initializer/TyphoonComponentInitializer.h index b17e12330..a533a847c 100644 --- a/Source/Component/Initializer/SpringComponentInitializer.h +++ b/Source/Component/Initializer/TyphoonComponentInitializer.h @@ -14,21 +14,21 @@ #import -@class SpringComponentDefinition; +@class TyphoonComponentDefinition; typedef enum { - SpringComponentInitializerIsClassMethodGuess, - SpringComponentInitializerIsClassMethodYes, - SpringComponentInitializerIsClassMethodNo -} SpringComponentInitializerIsClassMethod; + TyphoonComponentInitializerIsClassMethodGuess, + TyphoonComponentInitializerIsClassMethodYes, + TyphoonComponentInitializerIsClassMethodNo +} TyphoonComponentInitializerIsClassMethod; -@interface SpringComponentInitializer : NSObject +@interface TyphoonComponentInitializer : NSObject { NSMutableArray* _injectedParameters; NSArray* _parameterNames; - __unsafe_unretained SpringComponentDefinition* _definition; - SpringComponentInitializerIsClassMethod _isClassMethodStrategy; + __unsafe_unretained TyphoonComponentDefinition* _definition; + TyphoonComponentInitializerIsClassMethod _isClassMethodStrategy; } @property(nonatomic) SEL selector; @@ -36,7 +36,7 @@ typedef enum - (id)initWithSelector:(SEL)initializer; -- (id)initWithSelector:(SEL)initializer isClassMethod:(SpringComponentInitializerIsClassMethod)isClassMethod; +- (id)initWithSelector:(SEL)initializer isClassMethod:(TyphoonComponentInitializerIsClassMethod)isClassMethod; - (void)injectParameterNamed:(NSString*)name withReference:(NSString*)reference; @@ -50,6 +50,6 @@ typedef enum - (NSInvocation*)asInvocationFor:(id)classOrInstance; -- (void)setComponentDefinition:(SpringComponentDefinition*)definition; +- (void)setComponentDefinition:(TyphoonComponentDefinition*)definition; @end \ No newline at end of file diff --git a/Source/Component/Initializer/SpringComponentInitializer.m b/Source/Component/Initializer/TyphoonComponentInitializer.m similarity index 81% rename from Source/Component/Initializer/SpringComponentInitializer.m rename to Source/Component/Initializer/TyphoonComponentInitializer.m index 285c6eed1..0891446b7 100644 --- a/Source/Component/Initializer/SpringComponentInitializer.m +++ b/Source/Component/Initializer/TyphoonComponentInitializer.m @@ -11,23 +11,23 @@ -#import "SpringComponentInitializer.h" -#import "SpringParameterInjectedByReference.h" -#import "NSObject+SpringIntrospectionUtils.h" -#import "SpringParameterInjectedByValue.h" -#import "SpringComponentDefinition.h" +#import "TyphoonComponentInitializer.h" +#import "TyphoonParameterInjectedByReference.h" +#import "NSObject+TyphoonIntrospectionUtils.h" +#import "TyphoonParameterInjectedByValue.h" +#import "TyphoonComponentDefinition.h" -@implementation SpringComponentInitializer +@implementation TyphoonComponentInitializer /* ============================================================ Initializers ============================================================ */ - (id)initWithSelector:(SEL)initializer { - return [self initWithSelector:initializer isClassMethod:SpringComponentInitializerIsClassMethodGuess]; + return [self initWithSelector:initializer isClassMethod:TyphoonComponentInitializerIsClassMethodGuess]; } -- (id)initWithSelector:(SEL)initializer isClassMethod:(SpringComponentInitializerIsClassMethod)isClassMethod; +- (id)initWithSelector:(SEL)initializer isClassMethod:(TyphoonComponentInitializerIsClassMethod)isClassMethod; { self = [super init]; if (self) @@ -56,7 +56,7 @@ - (void)injectParameterAtIndex:(NSUInteger)index withReference:(NSString*)refere { if (index != NSUIntegerMax && index < [_parameterNames count]) { - [_injectedParameters addObject:[[SpringParameterInjectedByReference alloc] initWithParameterIndex:index reference:reference]]; + [_injectedParameters addObject:[[TyphoonParameterInjectedByReference alloc] initWithParameterIndex:index reference:reference]]; } } @@ -70,8 +70,8 @@ - (void)injectParameterAt:(NSUInteger)index withValueAsText:(NSString*)text requ { if (index != NSUIntegerMax && index < [_parameterNames count]) { - SpringParameterInjectedByValue* parameterInjectedByValue = - [[SpringParameterInjectedByValue alloc] initWithIndex:index value:text classOrProtocol:classOrProtocol]; + TyphoonParameterInjectedByValue* parameterInjectedByValue = + [[TyphoonParameterInjectedByValue alloc] initWithIndex:index value:text classOrProtocol:classOrProtocol]; [parameterInjectedByValue setInitializer:self]; [_injectedParameters addObject:parameterInjectedByValue]; } @@ -107,7 +107,7 @@ - (NSInvocation*)asInvocationFor:(id)classOrInstance return invocation; } -- (void)setComponentDefinition:(SpringComponentDefinition*)definition +- (void)setComponentDefinition:(TyphoonComponentDefinition*)definition { _definition = definition; [self resolveIsClassMethod]; @@ -133,7 +133,7 @@ - (NSString*)description - (void)dealloc { - for (id parameter in _injectedParameters) + for (id parameter in _injectedParameters) { //Null out the __unsafe_unretained pointer back to self. [parameter setInitializer:nil]; @@ -172,11 +172,11 @@ - (BOOL)resolveIsClassMethod switch (_isClassMethodStrategy) { - case SpringComponentInitializerIsClassMethodNo: + case TyphoonComponentInitializerIsClassMethodNo: return NO; - case SpringComponentInitializerIsClassMethodYes: + case TyphoonComponentInitializerIsClassMethodYes: return YES; - case SpringComponentInitializerIsClassMethodGuess: + case TyphoonComponentInitializerIsClassMethodGuess: return ![NSStringFromSelector(_selector) hasPrefix:@"init"]; } } diff --git a/Source/Component/Initializer/SpringInjectedParameter.h b/Source/Component/Initializer/TyphoonInjectedParameter.h similarity index 61% rename from Source/Component/Initializer/SpringInjectedParameter.h rename to Source/Component/Initializer/TyphoonInjectedParameter.h index bb8babf73..40067b77b 100644 --- a/Source/Component/Initializer/SpringInjectedParameter.h +++ b/Source/Component/Initializer/TyphoonInjectedParameter.h @@ -12,20 +12,20 @@ #import -@class SpringComponentInitializer; +@class TyphoonComponentInitializer; typedef enum { - SpringParameterInjectedByReferenceType, - SpringParameterInjectedByValueType -} SpringParameterInjectionType; + TyphoonParameterInjectedByReferenceType, + TyphoonParameterInjectedByValueType +} TyphoonParameterInjectionType; -@protocol SpringInjectedParameter +@protocol TyphoonInjectedParameter - (NSUInteger)index; -- (SpringParameterInjectionType)type; +- (TyphoonParameterInjectionType)type; -- (void)setInitializer:(SpringComponentInitializer*)initializer; +- (void)setInitializer:(TyphoonComponentInitializer*)initializer; @end \ No newline at end of file diff --git a/Source/Component/Initializer/SpringParameterInjectedByReference.h b/Source/Component/Initializer/TyphoonParameterInjectedByReference.h similarity index 77% rename from Source/Component/Initializer/SpringParameterInjectedByReference.h rename to Source/Component/Initializer/TyphoonParameterInjectedByReference.h index dc9907bd8..98230ec00 100644 --- a/Source/Component/Initializer/SpringParameterInjectedByReference.h +++ b/Source/Component/Initializer/TyphoonParameterInjectedByReference.h @@ -13,13 +13,13 @@ #import -#import "SpringInjectedParameter.h" +#import "TyphoonInjectedParameter.h" -@interface SpringParameterInjectedByReference : NSObject +@interface TyphoonParameterInjectedByReference : NSObject @property (nonatomic, readonly) NSUInteger index; -@property (nonatomic, readonly) SpringParameterInjectionType type; +@property (nonatomic, readonly) TyphoonParameterInjectionType type; @property (nonatomic, strong, readonly) NSString* reference; - (id)initWithParameterIndex:(NSUInteger)parameterIndex reference:(NSString*)reference; diff --git a/Source/Component/Initializer/SpringParameterInjectedByReference.m b/Source/Component/Initializer/TyphoonParameterInjectedByReference.m similarity index 82% rename from Source/Component/Initializer/SpringParameterInjectedByReference.m rename to Source/Component/Initializer/TyphoonParameterInjectedByReference.m index 7311d2a00..70192f4d8 100644 --- a/Source/Component/Initializer/SpringParameterInjectedByReference.m +++ b/Source/Component/Initializer/TyphoonParameterInjectedByReference.m @@ -11,11 +11,11 @@ -#import "SpringParameterInjectedByReference.h" -#import "SpringComponentInitializer.h" +#import "TyphoonParameterInjectedByReference.h" +#import "TyphoonComponentInitializer.h" -@implementation SpringParameterInjectedByReference +@implementation TyphoonParameterInjectedByReference /* ============================================================ Initializers ============================================================ */ - (id)initWithParameterIndex:(NSUInteger)parameterIndex reference:(NSString*)reference @@ -30,12 +30,12 @@ - (id)initWithParameterIndex:(NSUInteger)parameterIndex reference:(NSString*)ref } /* =========================================================== Protocol Methods ========================================================= */ -- (SpringParameterInjectionType)type +- (TyphoonParameterInjectionType)type { - return SpringParameterInjectedByReferenceType; + return TyphoonParameterInjectedByReferenceType; } -- (void)setInitializer:(SpringComponentInitializer*)initializer +- (void)setInitializer:(TyphoonComponentInitializer*)initializer { //Do nothing. } diff --git a/Source/Component/Initializer/SpringParameterInjectedByValue.h b/Source/Component/Initializer/TyphoonParameterInjectedByValue.h similarity index 73% rename from Source/Component/Initializer/SpringParameterInjectedByValue.h rename to Source/Component/Initializer/TyphoonParameterInjectedByValue.h index db4779985..efe014cf1 100644 --- a/Source/Component/Initializer/SpringParameterInjectedByValue.h +++ b/Source/Component/Initializer/TyphoonParameterInjectedByValue.h @@ -13,18 +13,18 @@ #import -#import "SpringInjectedParameter.h" +#import "TyphoonInjectedParameter.h" -@class SpringTypeDescriptor; +@class TyphoonTypeDescriptor; -@interface SpringParameterInjectedByValue : NSObject +@interface TyphoonParameterInjectedByValue : NSObject { - __unsafe_unretained SpringComponentInitializer* _initializer; + __unsafe_unretained TyphoonComponentInitializer* _initializer; } @property(nonatomic, readonly) NSUInteger index; -@property(nonatomic, readonly) SpringParameterInjectionType type; +@property(nonatomic, readonly) TyphoonParameterInjectionType type; @property(nonatomic, strong, readonly) NSString* value; @property(nonatomic, strong, readonly) id classOrProtocol; @@ -35,6 +35,6 @@ * - classOrProtocol is set * - The parameter is an object type. (If the parameter is an object type, classOrProtocol must be set explicitly). */ -- (SpringTypeDescriptor*)resolveTypeWith:(id)classOrInstance; +- (TyphoonTypeDescriptor*)resolveTypeWith:(id)classOrInstance; @end \ No newline at end of file diff --git a/Source/Component/Initializer/SpringParameterInjectedByValue.m b/Source/Component/Initializer/TyphoonParameterInjectedByValue.m similarity index 79% rename from Source/Component/Initializer/SpringParameterInjectedByValue.m rename to Source/Component/Initializer/TyphoonParameterInjectedByValue.m index d067d373e..87c01dec9 100644 --- a/Source/Component/Initializer/SpringParameterInjectedByValue.m +++ b/Source/Component/Initializer/TyphoonParameterInjectedByValue.m @@ -11,13 +11,13 @@ #import -#import "SpringParameterInjectedByValue.h" -#import "SpringComponentInitializer.h" -#import "SpringTypeDescriptor.h" -#import "SpringIntrospectionUtils.h" +#import "TyphoonParameterInjectedByValue.h" +#import "TyphoonComponentInitializer.h" +#import "TyphoonTypeDescriptor.h" +#import "TyphoonIntrospectionUtils.h" -@implementation SpringParameterInjectedByValue +@implementation TyphoonParameterInjectedByValue /* ============================================================ Initializers ============================================================ */ - (id)initWithIndex:(NSUInteger)index value:(NSString*)value classOrProtocol:(id)classOrProtocol @@ -33,7 +33,7 @@ - (id)initWithIndex:(NSUInteger)index value:(NSString*)value classOrProtocol:(id } /* ========================================================== Interface Methods ========================================================= */ -- (SpringTypeDescriptor*)resolveTypeWith:(id)classOrInstance +- (TyphoonTypeDescriptor*)resolveTypeWith:(id)classOrInstance { if (_classOrProtocol) { @@ -49,25 +49,25 @@ - (SpringTypeDescriptor*)resolveTypeWith:(id)classOrInstance { clazz = [classOrInstance class]; } - NSArray* typeCodes = [SpringIntrospectionUtils typeCodesForSelector:_initializer.selector ofClass:clazz isClassMethod:isClass]; + NSArray* typeCodes = [TyphoonIntrospectionUtils typeCodesForSelector:_initializer.selector ofClass:clazz isClassMethod:isClass]; if ([[typeCodes objectAtIndex:_index] isEqualToString:@"@"]) { [NSException raise:NSInvalidArgumentException format:@"Unless the type is primitive (int, BOOL, etc), initializer injection requires the required class to be specified. Eg: "]; } - return [SpringTypeDescriptor descriptorWithTypeCode:[typeCodes objectAtIndex:_index]]; + return [TyphoonTypeDescriptor descriptorWithTypeCode:[typeCodes objectAtIndex:_index]]; } /* =========================================================== Protocol Methods ========================================================= */ -- (SpringParameterInjectionType)type +- (TyphoonParameterInjectionType)type { - return SpringParameterInjectedByValueType; + return TyphoonParameterInjectedByValueType; } -- (void)setInitializer:(SpringComponentInitializer*)initializer +- (void)setInitializer:(TyphoonComponentInitializer*)initializer { _initializer = initializer; } diff --git a/Source/Component/Properties/SpringInjectedProperty.h b/Source/Component/Properties/TyphoonInjectedProperty.h similarity index 60% rename from Source/Component/Properties/SpringInjectedProperty.h rename to Source/Component/Properties/TyphoonInjectedProperty.h index 471bafba0..c982b58fb 100644 --- a/Source/Component/Properties/SpringInjectedProperty.h +++ b/Source/Component/Properties/TyphoonInjectedProperty.h @@ -13,19 +13,19 @@ #import -#import "SpringIntrospectiveNSObject.h" +#import "TyphoonIntrospectiveNSObject.h" -typedef enum SpringPropertyInjectionType +typedef enum { - SpringPropertyInjectionByReferenceType, - SpringPropertyInjectionByTypeType, - SpringPropertyInjectionByValueType -} SpringPropertyInjectionType; + TyphoonPropertyInjectionByReferenceType, + TyphoonPropertyInjectionByTypeType, + TyphoonPropertyInjectionByValueType +} TyphoonPropertyInjectionType; -@protocol SpringInjectedProperty +@protocol TyphoonInjectedProperty - (NSString*)name; -- (SpringPropertyInjectionType)type; +- (TyphoonPropertyInjectionType)type; @end \ No newline at end of file diff --git a/Source/Component/Properties/SpringPropertyInjectedByReference.h b/Source/Component/Properties/TyphoonPropertyInjectedByReference.h similarity index 78% rename from Source/Component/Properties/SpringPropertyInjectedByReference.h rename to Source/Component/Properties/TyphoonPropertyInjectedByReference.h index 6be66b33c..bef69b6c9 100644 --- a/Source/Component/Properties/SpringPropertyInjectedByReference.h +++ b/Source/Component/Properties/TyphoonPropertyInjectedByReference.h @@ -12,13 +12,13 @@ #import -#import "SpringInjectedProperty.h" +#import "TyphoonInjectedProperty.h" -@interface SpringPropertyInjectedByReference : NSObject +@interface TyphoonPropertyInjectedByReference : NSObject @property (nonatomic, strong, readonly) NSString* name; -@property (nonatomic, readonly) SpringPropertyInjectionType type; +@property (nonatomic, readonly) TyphoonPropertyInjectionType type; @property (nonatomic, strong, readonly) NSString* reference; - (id)initWithName:(NSString*)name reference:(NSString*)reference; diff --git a/Source/Component/Properties/SpringPropertyInjectedByReference.m b/Source/Component/Properties/TyphoonPropertyInjectedByReference.m similarity index 88% rename from Source/Component/Properties/SpringPropertyInjectedByReference.m rename to Source/Component/Properties/TyphoonPropertyInjectedByReference.m index c0d52b626..62f6bde22 100644 --- a/Source/Component/Properties/SpringPropertyInjectedByReference.m +++ b/Source/Component/Properties/TyphoonPropertyInjectedByReference.m @@ -12,10 +12,10 @@ -#import "SpringPropertyInjectedByReference.h" +#import "TyphoonPropertyInjectedByReference.h" -@implementation SpringPropertyInjectedByReference +@implementation TyphoonPropertyInjectedByReference { } @@ -33,9 +33,9 @@ - (id)initWithName:(NSString*)name reference:(NSString*)reference } /* =========================================================== Protocol Methods ========================================================= */ -- (SpringPropertyInjectionType)type +- (TyphoonPropertyInjectionType)type { - return SpringPropertyInjectionByReferenceType; + return TyphoonPropertyInjectionByReferenceType; } /* ============================================================ Utility Methods ========================================================= */ diff --git a/Source/Component/Properties/SpringPropertyInjectedByType.h b/Source/Component/Properties/TyphoonPropertyInjectedByType.h similarity index 75% rename from Source/Component/Properties/SpringPropertyInjectedByType.h rename to Source/Component/Properties/TyphoonPropertyInjectedByType.h index 58048905d..9551022d8 100644 --- a/Source/Component/Properties/SpringPropertyInjectedByType.h +++ b/Source/Component/Properties/TyphoonPropertyInjectedByType.h @@ -14,13 +14,13 @@ #import -#import "SpringInjectedProperty.h" +#import "TyphoonInjectedProperty.h" -@interface SpringPropertyInjectedByType : NSObject +@interface TyphoonPropertyInjectedByType : NSObject @property (nonatomic, strong, readonly) NSString* name; -@property (nonatomic, readonly) SpringPropertyInjectionType type; +@property (nonatomic, readonly) TyphoonPropertyInjectionType type; - (id)initWithName:(NSString*)name; diff --git a/Source/Component/Properties/SpringPropertyInjectedByType.m b/Source/Component/Properties/TyphoonPropertyInjectedByType.m similarity index 82% rename from Source/Component/Properties/SpringPropertyInjectedByType.m rename to Source/Component/Properties/TyphoonPropertyInjectedByType.m index ffe0b4392..474313410 100644 --- a/Source/Component/Properties/SpringPropertyInjectedByType.m +++ b/Source/Component/Properties/TyphoonPropertyInjectedByType.m @@ -11,10 +11,10 @@ -#import "SpringPropertyInjectedByType.h" +#import "TyphoonPropertyInjectedByType.h" -@implementation SpringPropertyInjectedByType +@implementation TyphoonPropertyInjectedByType /* ============================================================ Initializers ============================================================ */ @@ -29,9 +29,9 @@ - (id)initWithName:(NSString*)name } /* =========================================================== Protocol Methods ========================================================= */ -- (SpringPropertyInjectionType)type +- (TyphoonPropertyInjectionType)type { - return SpringPropertyInjectionByTypeType; + return TyphoonPropertyInjectionByTypeType; } diff --git a/Source/Component/Properties/SpringPropertyInjectedByValue.h b/Source/Component/Properties/TyphoonPropertyInjectedByValue.h similarity index 78% rename from Source/Component/Properties/SpringPropertyInjectedByValue.h rename to Source/Component/Properties/TyphoonPropertyInjectedByValue.h index dc0fd3ad7..e7d5b2abe 100644 --- a/Source/Component/Properties/SpringPropertyInjectedByValue.h +++ b/Source/Component/Properties/TyphoonPropertyInjectedByValue.h @@ -11,16 +11,16 @@ #import -#import "SpringInjectedProperty.h" +#import "TyphoonInjectedProperty.h" -@interface SpringPropertyInjectedByValue : NSObject +@interface TyphoonPropertyInjectedByValue : NSObject { NSString* _textValue; } @property (nonatomic, strong, readonly) NSString* name; -@property (nonatomic, readonly) SpringPropertyInjectionType type; +@property (nonatomic, readonly) TyphoonPropertyInjectionType type; @property (nonatomic, strong, readonly) NSString* textValue; - (id)initWithName:(NSString*)name value:(NSString*)value; diff --git a/Source/Component/Properties/SpringPropertyInjectedByValue.m b/Source/Component/Properties/TyphoonPropertyInjectedByValue.m similarity index 88% rename from Source/Component/Properties/SpringPropertyInjectedByValue.m rename to Source/Component/Properties/TyphoonPropertyInjectedByValue.m index bc6359748..1f07f2774 100644 --- a/Source/Component/Properties/SpringPropertyInjectedByValue.m +++ b/Source/Component/Properties/TyphoonPropertyInjectedByValue.m @@ -12,10 +12,10 @@ -#import "SpringPropertyInjectedByValue.h" +#import "TyphoonPropertyInjectedByValue.h" -@implementation SpringPropertyInjectedByValue +@implementation TyphoonPropertyInjectedByValue { } @@ -33,9 +33,9 @@ - (id)initWithName:(NSString*)name value:(NSString*)value } /* =========================================================== Protocol Methods ========================================================= */ -- (SpringPropertyInjectionType)type +- (TyphoonPropertyInjectionType)type { - return SpringPropertyInjectionByValueType; + return TyphoonPropertyInjectionByValueType; } /* ============================================================ Utility Methods ========================================================= */ diff --git a/Source/Component/Properties/SpringPropertyInjectionDelegate.h b/Source/Component/Properties/TyphoonPropertyInjectionDelegate.h similarity index 90% rename from Source/Component/Properties/SpringPropertyInjectionDelegate.h rename to Source/Component/Properties/TyphoonPropertyInjectionDelegate.h index ed91a4c86..cfe3e0641 100644 --- a/Source/Component/Properties/SpringPropertyInjectionDelegate.h +++ b/Source/Component/Properties/TyphoonPropertyInjectionDelegate.h @@ -13,7 +13,7 @@ #import -@protocol SpringPropertyInjectionDelegate +@protocol TyphoonPropertyInjectionDelegate - (void)beforePropertiesSet; diff --git a/Source/Component/SpringComponentDefinition+BlockBuilders.h b/Source/Component/SpringComponentDefinition+BlockBuilders.h deleted file mode 100644 index 31f2c1356..000000000 --- a/Source/Component/SpringComponentDefinition+BlockBuilders.h +++ /dev/null @@ -1,59 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// AppsQuick.ly -// Copyright 2013 AppsQuick.ly -// All Rights Reserved. -// -// NOTICE: AppsQuick.ly permits you to use, modify, and distribute this file -// in accordance with the terms of the license agreement accompanying it. -// -//////////////////////////////////////////////////////////////////////////////// - - - -#import -#import "SpringComponentDefinition.h" - -@class SpringComponentInitializer; -@class SpringComponentDefinition; - - -typedef void(^SpringInitializerBlock)(SpringComponentInitializer* initializer); - -typedef void(^SpringPropertyInjectionBlock)(SpringComponentDefinition* propertyInjector); - - -@interface SpringComponentDefinition (BlockBuilders) - - -/* ====================================================================================================================================== */ -#pragma mark No injection - -+ (SpringComponentDefinition*)definitionWithClass:(Class)clazz; - -+ (SpringComponentDefinition*)definitionWithClass:(Class)clazz key:(NSString*)key; - - -/* ====================================================================================================================================== */ -#pragma mark Anonymous keys - -+ (SpringComponentDefinition*)definitionWithClass:(Class)clazz initializer:(SpringInitializerBlock)initializer - properties:(SpringPropertyInjectionBlock)properties; - -+ (SpringComponentDefinition*)definitionWithClass:(Class)clazz initializer:(SpringInitializerBlock)initializer; - - -+ (SpringComponentDefinition*)definitionWithClass:(Class)clazz properties:(SpringPropertyInjectionBlock)properties; - - -/* ====================================================================================================================================== */ -#pragma mark - Explicit keys -+ (SpringComponentDefinition*)definitionWithClass:(Class)clazz key:(NSString*)key initializer:(SpringInitializerBlock)initializer; - -+ (SpringComponentDefinition*)definitionWithClass:(Class)clazz key:(NSString*)key properties:(SpringPropertyInjectionBlock)properties; - -+ (SpringComponentDefinition*)definitionWithClass:(Class)clazz key:(NSString*)key initializer:(SpringInitializerBlock)initializer - properties:(SpringPropertyInjectionBlock)properties; - - -@end \ No newline at end of file diff --git a/Source/Component/SpringComponentDefinition+BlockBuilders.m b/Source/Component/SpringComponentDefinition+BlockBuilders.m deleted file mode 100644 index 3ffd06a8a..000000000 --- a/Source/Component/SpringComponentDefinition+BlockBuilders.m +++ /dev/null @@ -1,89 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// AppsQuick.ly -// Copyright 2013 AppsQuick.ly -// All Rights Reserved. -// -// NOTICE: AppsQuick.ly permits you to use, modify, and distribute this file -// in accordance with the terms of the license agreement accompanying it. -// -//////////////////////////////////////////////////////////////////////////////// - - -#import "SpringComponentDefinition+BlockBuilders.h" -#import "SpringComponentInitializer.h" -#import "SpringComponentDefinition.h" - - -@implementation SpringComponentDefinition (BlockBuilders) - -/* ====================================================================================================================================== */ -#pragma mark - No injection - - - -+ (SpringComponentDefinition*)definitionWithClass:(Class)clazz -{ - return [[SpringComponentDefinition alloc] initWithClazz:clazz key:nil]; -} - -+ (SpringComponentDefinition*)definitionWithClass:(Class)clazz key:(NSString*)key -{ - return [[SpringComponentDefinition alloc] initWithClazz:clazz key:key]; -} - - -/* ====================================================================================================================================== */ -#pragma mark Anonymous keys - -+ (SpringComponentDefinition*)definitionWithClass:(Class)clazz initializer:(SpringInitializerBlock)initializer -{ - return [SpringComponentDefinition definitionWithClass:clazz key:nil initializer:initializer properties:nil]; -} - -+ (SpringComponentDefinition*)definitionWithClass:(Class)clazz properties:(SpringPropertyInjectionBlock)properties -{ - return [SpringComponentDefinition definitionWithClass:clazz key:nil initializer:nil properties:properties]; -} - -+ (SpringComponentDefinition*)definitionWithClass:(Class)clazz initializer:(SpringInitializerBlock)initializer - properties:(SpringPropertyInjectionBlock)properties -{ - return [SpringComponentDefinition definitionWithClass:clazz key:nil initializer:initializer properties:properties]; -} - - -/* ====================================================================================================================================== */ -#pragma mark Explicit keys -+ (SpringComponentDefinition*)definitionWithClass:(Class)clazz key:(NSString*)key initializer:(SpringInitializerBlock)initializer - properties:(SpringPropertyInjectionBlock)properties -{ - - SpringComponentDefinition* definition = [[SpringComponentDefinition alloc] initWithClazz:clazz key:key]; - if (initializer) - { - SpringComponentInitializer* componentInitializer = [[SpringComponentInitializer alloc] init]; - definition.initializer = componentInitializer; - __weak SpringComponentInitializer* weakInitializer = componentInitializer; - initializer(weakInitializer); - } - if (properties) - { - __weak SpringComponentDefinition* weakDefinition = definition; - properties(weakDefinition); - } - return definition; -} - -+ (SpringComponentDefinition*)definitionWithClass:(Class)clazz key:(NSString*)key initializer:(SpringInitializerBlock)initializer -{ - return [SpringComponentDefinition definitionWithClass:clazz key:key initializer:initializer properties:nil]; -} - -+ (SpringComponentDefinition*)definitionWithClass:(Class)clazz key:(NSString*)key properties:(SpringPropertyInjectionBlock)properties -{ - return [SpringComponentDefinition definitionWithClass:clazz key:key initializer:nil properties:properties]; -} - - -@end \ No newline at end of file diff --git a/Source/Component/TyphoonComponentDefinition+BlockBuilders.h b/Source/Component/TyphoonComponentDefinition+BlockBuilders.h new file mode 100644 index 000000000..272dcca8b --- /dev/null +++ b/Source/Component/TyphoonComponentDefinition+BlockBuilders.h @@ -0,0 +1,60 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// AppsQuick.ly +// Copyright 2013 AppsQuick.ly +// All Rights Reserved. +// +// NOTICE: AppsQuick.ly permits you to use, modify, and distribute this file +// in accordance with the terms of the license agreement accompanying it. +// +//////////////////////////////////////////////////////////////////////////////// + + + +#import +#import "TyphoonComponentDefinition.h" + +@class TyphoonComponentInitializer; +@class TyphoonComponentDefinition; + + +typedef void(^TyphoonInitializationBlock)(TyphoonComponentInitializer* initializer); + +typedef void(^TyphoonPropertyInjectionBlock)(TyphoonComponentDefinition* propertyInjector); + + +@interface TyphoonComponentDefinition (BlockBuilders) + + +/* ====================================================================================================================================== */ +#pragma mark No injection + ++ (TyphoonComponentDefinition*)withClass:(Class)clazz; + ++ (TyphoonComponentDefinition*)withClass:(Class)clazz key:(NSString*)key; + + +/* ====================================================================================================================================== */ +#pragma mark Anonymous keys + ++ (TyphoonComponentDefinition*)withClass:(Class)clazz initialization:(TyphoonInitializationBlock)initialization + properties:(TyphoonPropertyInjectionBlock)properties; + ++ (TyphoonComponentDefinition*)withClass:(Class)clazz initialization:(TyphoonInitializationBlock)initialization; + + ++ (TyphoonComponentDefinition*)withClass:(Class)clazz properties:(TyphoonPropertyInjectionBlock)properties; + + +/* ====================================================================================================================================== */ +#pragma mark - Explicit keys + ++ (TyphoonComponentDefinition*)withClass:(Class)clazz key:(NSString*)key initialization:(TyphoonInitializationBlock)initialization; + ++ (TyphoonComponentDefinition*)withClass:(Class)clazz key:(NSString*)key properties:(TyphoonPropertyInjectionBlock)properties; + ++ (TyphoonComponentDefinition*)withClass:(Class)clazz key:(NSString*)key initialization:(TyphoonInitializationBlock)initialization + properties:(TyphoonPropertyInjectionBlock)properties; + + +@end \ No newline at end of file diff --git a/Source/Component/TyphoonComponentDefinition+BlockBuilders.m b/Source/Component/TyphoonComponentDefinition+BlockBuilders.m new file mode 100644 index 000000000..166ff8d01 --- /dev/null +++ b/Source/Component/TyphoonComponentDefinition+BlockBuilders.m @@ -0,0 +1,89 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// AppsQuick.ly +// Copyright 2013 AppsQuick.ly +// All Rights Reserved. +// +// NOTICE: AppsQuick.ly permits you to use, modify, and distribute this file +// in accordance with the terms of the license agreement accompanying it. +// +//////////////////////////////////////////////////////////////////////////////// + + +#import "TyphoonComponentDefinition+BlockBuilders.h" +#import "TyphoonComponentInitializer.h" +#import "TyphoonComponentDefinition.h" + + +@implementation TyphoonComponentDefinition (BlockBuilders) + +/* ====================================================================================================================================== */ +#pragma mark - No injection + + + ++ (TyphoonComponentDefinition*)withClass:(Class)clazz +{ + return [[TyphoonComponentDefinition alloc] initWithClass:clazz key:nil]; +} + ++ (TyphoonComponentDefinition*)withClass:(Class)clazz key:(NSString*)key +{ + return [[TyphoonComponentDefinition alloc] initWithClass:clazz key:key]; +} + + +/* ====================================================================================================================================== */ +#pragma mark Anonymous keys + ++ (TyphoonComponentDefinition*)withClass:(Class)clazz initialization:(TyphoonInitializationBlock)initialization +{ + return [TyphoonComponentDefinition withClass:clazz key:nil initialization:initialization properties:nil]; +} + ++ (TyphoonComponentDefinition*)withClass:(Class)clazz properties:(TyphoonPropertyInjectionBlock)properties +{ + return [TyphoonComponentDefinition withClass:clazz key:nil initialization:nil properties:properties]; +} + ++ (TyphoonComponentDefinition*)withClass:(Class)clazz initialization:(TyphoonInitializationBlock)initialization + properties:(TyphoonPropertyInjectionBlock)properties +{ + return [TyphoonComponentDefinition withClass:clazz key:nil initialization:initialization properties:properties]; +} + + +/* ====================================================================================================================================== */ +#pragma mark Explicit keys ++ (TyphoonComponentDefinition*)withClass:(Class)clazz key:(NSString*)key initialization:(TyphoonInitializationBlock)initialization + properties:(TyphoonPropertyInjectionBlock)properties +{ + + TyphoonComponentDefinition* definition = [[TyphoonComponentDefinition alloc] initWithClass:clazz key:key]; + if (initialization) + { + TyphoonComponentInitializer* componentInitializer = [[TyphoonComponentInitializer alloc] init]; + definition.initializer = componentInitializer; + __weak TyphoonComponentInitializer* weakInitializer = componentInitializer; + initialization(weakInitializer); + } + if (properties) + { + __weak TyphoonComponentDefinition* weakDefinition = definition; + properties(weakDefinition); + } + return definition; +} + ++ (TyphoonComponentDefinition*)withClass:(Class)clazz key:(NSString*)key initialization:(TyphoonInitializationBlock)initialization +{ + return [TyphoonComponentDefinition withClass:clazz key:key initialization:initialization properties:nil]; +} + ++ (TyphoonComponentDefinition*)withClass:(Class)clazz key:(NSString*)key properties:(TyphoonPropertyInjectionBlock)properties +{ + return [TyphoonComponentDefinition withClass:clazz key:key initialization:nil properties:properties]; +} + + +@end \ No newline at end of file diff --git a/Source/Component/SpringComponentDefinition.h b/Source/Component/TyphoonComponentDefinition.h similarity index 66% rename from Source/Component/SpringComponentDefinition.h rename to Source/Component/TyphoonComponentDefinition.h index 860f3743b..1b29e5684 100644 --- a/Source/Component/SpringComponentDefinition.h +++ b/Source/Component/TyphoonComponentDefinition.h @@ -14,34 +14,34 @@ #import -@class SpringComponentInitializer; -@protocol SpringInjectedProperty; +@class TyphoonComponentInitializer; +@protocol TyphoonInjectedProperty; typedef enum { - SpringComponentLifeCycleSingleton, - SpringComponentLifeCyclePrototype -} SpringComponentLifecycle; + TyphoonComponentLifeCycleSingleton, + TyphoonComponentLifeCyclePrototype +} TyphoonComponentLifecycle; -@interface SpringComponentDefinition : NSObject +@interface TyphoonComponentDefinition : NSObject { NSMutableSet* _injectedProperties; } @property(nonatomic, readonly) Class type; -@property(nonatomic, strong) NSString* key; +@property(nonatomic, strong, readonly) NSString* key; @property(nonatomic, strong, readonly) NSString* factoryComponent; -@property(nonatomic, strong) SpringComponentInitializer* initializer; +@property(nonatomic, strong) TyphoonComponentInitializer* initializer; @property(nonatomic) SEL beforePropertyInjection; @property(nonatomic) SEL afterPropertyInjection; @property(nonatomic, strong, readonly) NSSet* injectedProperties; -@property(nonatomic) SpringComponentLifecycle lifecycle; +@property(nonatomic) TyphoonComponentLifecycle lifecycle; -- (id)initWithClazz:(Class)clazz key:(NSString*)key; +- (id)initWithClass:(Class)clazz key:(NSString*)key; -- (id)initWithClazz:(Class)clazz key:(NSString*)key factoryComponent:(NSString*)factoryComponent; +- (id)initWithClass:(Class)clazz key:(NSString*)key factoryComponent:(NSString*)factoryComponent; - (void)injectProperty:(NSString*)propertyName; @@ -49,7 +49,7 @@ typedef enum - (void)injectProperty:(NSString*)propertyName withValueAsText:(NSString*)textValue; -- (void)addInjectedProperty:(id )property; +- (void)addInjectedProperty:(id )property; - (NSSet*)propertiesInjectedByValue; diff --git a/Source/Component/SpringComponentDefinition.m b/Source/Component/TyphoonComponentDefinition.m similarity index 61% rename from Source/Component/SpringComponentDefinition.m rename to Source/Component/TyphoonComponentDefinition.m index c43a3e4e0..42640eddd 100644 --- a/Source/Component/SpringComponentDefinition.m +++ b/Source/Component/TyphoonComponentDefinition.m @@ -10,25 +10,32 @@ //////////////////////////////////////////////////////////////////////////////// -#import "SpringComponentInitializer.h" -#import "SpringComponentDefinition.h" -#import "SpringPropertyInjectedByType.h" -#import "SpringPropertyInjectedByReference.h" -#import "SpringPropertyInjectedByValue.h" +#import "TyphoonComponentInitializer.h" +#import "TyphoonComponentDefinition.h" +#import "TyphoonPropertyInjectedByType.h" +#import "TyphoonPropertyInjectedByReference.h" +#import "TyphoonPropertyInjectedByValue.h" -@implementation SpringComponentDefinition - +@implementation TyphoonComponentDefinition /* ============================================================ Initializers ============================================================ */ -- (id)initWithClazz:(Class)clazz key:(NSString*)key factoryComponent:(NSString*)factoryComponent +- (id)initWithClass:(Class)clazz key:(NSString*)key factoryComponent:(NSString*)factoryComponent { self = [super init]; if (self) { _type = clazz; - _key = [key copy]; + if ([key length] == 0) + { + NSString* uuidStr = [[NSProcessInfo processInfo] globallyUniqueString]; + _key = [NSString stringWithFormat:@"%@%@", NSStringFromClass(_type), uuidStr]; + } + else + { + _key = [key copy]; + } _factoryComponent = [factoryComponent copy]; _injectedProperties = [[NSMutableSet alloc] init]; [self validateRequiredParametersAreSet]; @@ -36,47 +43,47 @@ - (id)initWithClazz:(Class)clazz key:(NSString*)key factoryComponent:(NSString*) return self; } -- (id)initWithClazz:(Class)clazz key:(NSString*)key +- (id)initWithClass:(Class)clazz key:(NSString*)key { - return [self initWithClazz:clazz key:key factoryComponent:nil]; + return [self initWithClass:clazz key:key factoryComponent:nil]; } - (id)init { - return [self initWithClazz:nil key:nil factoryComponent:nil]; + return [self initWithClass:nil key:nil factoryComponent:nil]; } /* ========================================================== Interface Methods ========================================================= */ - (void)injectProperty:(NSString*)propertyName { - [_injectedProperties addObject:[[SpringPropertyInjectedByType alloc] initWithName:propertyName]]; + [_injectedProperties addObject:[[TyphoonPropertyInjectedByType alloc] initWithName:propertyName]]; } - (void)injectProperty:(NSString*)propertyName withReference:(NSString*)reference { - [_injectedProperties addObject:[[SpringPropertyInjectedByReference alloc] initWithName:propertyName reference:reference]]; + [_injectedProperties addObject:[[TyphoonPropertyInjectedByReference alloc] initWithName:propertyName reference:reference]]; } - (void)injectProperty:(NSString*)propertyName withValueAsText:(NSString*)textValue { - [_injectedProperties addObject:[[SpringPropertyInjectedByValue alloc] initWithName:propertyName value:textValue]]; + [_injectedProperties addObject:[[TyphoonPropertyInjectedByValue alloc] initWithName:propertyName value:textValue]]; } -- (void)addInjectedProperty:(id )property +- (void)addInjectedProperty:(id )property { - if ([property isKindOfClass:[SpringPropertyInjectedByReference class]]) + if ([property isKindOfClass:[TyphoonPropertyInjectedByReference class]]) { - SpringPropertyInjectedByReference* referenceProperty = (SpringPropertyInjectedByReference*) property; + TyphoonPropertyInjectedByReference* referenceProperty = (TyphoonPropertyInjectedByReference*) property; [self injectProperty:referenceProperty.name withReference:referenceProperty.reference]; } - else if ([property isKindOfClass:[SpringPropertyInjectedByType class]]) + else if ([property isKindOfClass:[TyphoonPropertyInjectedByType class]]) { [self injectProperty:property.name]; } - else if ([property isKindOfClass:[SpringPropertyInjectedByValue class]]) + else if ([property isKindOfClass:[TyphoonPropertyInjectedByValue class]]) { - SpringPropertyInjectedByValue* valueProperty = (SpringPropertyInjectedByValue*) property; + TyphoonPropertyInjectedByValue* valueProperty = (TyphoonPropertyInjectedByValue*) property; [self injectProperty:valueProperty.name withValueAsText:valueProperty.textValue]; } } @@ -86,7 +93,7 @@ - (NSSet*)injectedProperties return [_injectedProperties copy]; } -- (void)setInitializer:(SpringComponentInitializer*)initializer +- (void)setInitializer:(TyphoonComponentInitializer*)initializer { _initializer = initializer; [_initializer setComponentDefinition:self]; @@ -94,17 +101,17 @@ - (void)setInitializer:(SpringComponentInitializer*)initializer - (NSSet*)propertiesInjectedByValue { - return [self injectedPropertiesWithKindClass:[SpringPropertyInjectedByValue class]]; + return [self injectedPropertiesWithKindClass:[TyphoonPropertyInjectedByValue class]]; } - (NSSet*)propertiesInjectedByType { - return [self injectedPropertiesWithKindClass:[SpringPropertyInjectedByType class]]; + return [self injectedPropertiesWithKindClass:[TyphoonPropertyInjectedByType class]]; } - (NSSet*)propertiesInjectedByReference { - return [self injectedPropertiesWithKindClass:[SpringPropertyInjectedByReference class]]; + return [self injectedPropertiesWithKindClass:[TyphoonPropertyInjectedByReference class]]; } @@ -116,7 +123,7 @@ - (NSString*)description [description appendFormat:@", self.type=%@", self.type]; [description appendFormat:@", self.key=%@", self.key]; [description appendFormat:@", self.initializer=%@", self.initializer]; - [description appendFormat:@", self.lifecycle=%@", self.lifecycle == SpringComponentLifeCycleSingleton ? @"Singleton" : @"Prototype"]; + [description appendFormat:@", self.lifecycle=%@", self.lifecycle == TyphoonComponentLifeCycleSingleton ? @"Singleton" : @"Prototype"]; [description appendString:@">"]; return description; } diff --git a/Source/Factory/Mutator/SpringComponentFactoryMutator.h b/Source/Factory/Mutator/TyphoonComponentFactoryMutator.h similarity index 72% rename from Source/Factory/Mutator/SpringComponentFactoryMutator.h rename to Source/Factory/Mutator/TyphoonComponentFactoryMutator.h index 28764092f..59f69a017 100644 --- a/Source/Factory/Mutator/SpringComponentFactoryMutator.h +++ b/Source/Factory/Mutator/TyphoonComponentFactoryMutator.h @@ -1,19 +1,18 @@ //////////////////////////////////////////////////////////////////////////////// // -// AppsQuick.ly -// Copyright 2012 AppsQuick.ly +// JASPER BLUES +// Copyright 2013 Jasper Blues // All Rights Reserved. // -// NOTICE: AppsQuick.ly permits you to use, modify, and distribute this file +// NOTICE: Jasper Blues permits you to use, modify, and distribute this file // in accordance with the terms of the license agreement accompanying it. // //////////////////////////////////////////////////////////////////////////////// - #import -@protocol SpringComponentFactoryMutator +@protocol TyphoonComponentFactoryMutator - (void)mutateComponentDefinitionsIfRequired:(NSArray*)componentDefinitions; diff --git a/Source/Factory/PropertyConfigurers/SpringPropertyPlaceholderConfigurer.h b/Source/Factory/PropertyConfigurers/TyphoonPropertyPlaceholderConfigurer.h similarity index 56% rename from Source/Factory/PropertyConfigurers/SpringPropertyPlaceholderConfigurer.h rename to Source/Factory/PropertyConfigurers/TyphoonPropertyPlaceholderConfigurer.h index 1edaf4b57..19807289c 100644 --- a/Source/Factory/PropertyConfigurers/SpringPropertyPlaceholderConfigurer.h +++ b/Source/Factory/PropertyConfigurers/TyphoonPropertyPlaceholderConfigurer.h @@ -1,34 +1,33 @@ //////////////////////////////////////////////////////////////////////////////// // -// AppsQuick.ly -// Copyright 2012 AppsQuick.ly +// JASPER BLUES +// Copyright 2013 Jasper Blues // All Rights Reserved. // -// NOTICE: AppsQuick.ly permits you to use, modify, and distribute this file +// NOTICE: Jasper Blues permits you to use, modify, and distribute this file // in accordance with the terms of the license agreement accompanying it. // //////////////////////////////////////////////////////////////////////////////// - #import -#import "SpringComponentFactoryMutator.h" +#import "TyphoonComponentFactoryMutator.h" -@protocol SpringResource; +@protocol TyphoonResource; -@interface SpringPropertyPlaceholderConfigurer : NSObject +@interface TyphoonPropertyPlaceholderConfigurer : NSObject { NSString* _prefix; NSString* _suffix; NSMutableDictionary* _properties; } -+ (SpringPropertyPlaceholderConfigurer*)configurer; ++ (TyphoonPropertyPlaceholderConfigurer*)configurer; - (id)initWithPrefix:(NSString*)prefix suffix:(NSString*)suffix; -- (void)usePropertyStyleResource:(id )resource; +- (void)usePropertyStyleResource:(id )resource; - (NSDictionary*)properties; diff --git a/Source/Factory/PropertyConfigurers/SpringPropertyPlaceholderConfigurer.m b/Source/Factory/PropertyConfigurers/TyphoonPropertyPlaceholderConfigurer.m similarity index 76% rename from Source/Factory/PropertyConfigurers/SpringPropertyPlaceholderConfigurer.m rename to Source/Factory/PropertyConfigurers/TyphoonPropertyPlaceholderConfigurer.m index 98811e0e0..6b1a073d2 100644 --- a/Source/Factory/PropertyConfigurers/SpringPropertyPlaceholderConfigurer.m +++ b/Source/Factory/PropertyConfigurers/TyphoonPropertyPlaceholderConfigurer.m @@ -1,29 +1,28 @@ //////////////////////////////////////////////////////////////////////////////// // -// AppsQuick.ly -// Copyright 2012 AppsQuick.ly +// JASPER BLUES +// Copyright 2013 Jasper Blues // All Rights Reserved. // -// NOTICE: AppsQuick.ly permits you to use, modify, and distribute this file +// NOTICE: Jasper Blues permits you to use, modify, and distribute this file // in accordance with the terms of the license agreement accompanying it. // //////////////////////////////////////////////////////////////////////////////// +#import "TyphoonPropertyPlaceholderConfigurer.h" +#import "TyphoonResource.h" +#import "TyphoonComponentDefinition.h" +#import "TyphoonPropertyInjectedByValue.h" -#import "SpringPropertyPlaceholderConfigurer.h" -#import "SpringResource.h" -#import "SpringComponentDefinition.h" -#import "SpringPropertyInjectedByValue.h" - -@interface SpringPropertyInjectedByValue(PropertyPlaceHolderConfigurer) +@interface TyphoonPropertyInjectedByValue (PropertyPlaceHolderConfigurer) - (void)setTextValue:(NSString*)textValue; @end -@implementation SpringPropertyInjectedByValue(PropertyPlaceHolderConfigurer) +@implementation TyphoonPropertyInjectedByValue (PropertyPlaceHolderConfigurer) - (void)setTextValue:(NSString*)textValue { @@ -33,10 +32,10 @@ - (void)setTextValue:(NSString*)textValue @end -@implementation SpringPropertyPlaceholderConfigurer +@implementation TyphoonPropertyPlaceholderConfigurer /* =========================================================== Class Methods ============================================================ */ -+ (SpringPropertyPlaceholderConfigurer*)configurer ++ (TyphoonPropertyPlaceholderConfigurer*)configurer { return [[[self class] alloc] init]; } @@ -60,7 +59,7 @@ - (id)init } /* ========================================================== Interface Methods ========================================================= */ -- (void)usePropertyStyleResource:(id )resource +- (void)usePropertyStyleResource:(id )resource { NSArray* lines = [[resource asString] componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; for (NSString* line in lines) @@ -84,9 +83,9 @@ - (NSDictionary*)properties /* =========================================================== Protocol Methods ========================================================= */ - (void)mutateComponentDefinitionsIfRequired:(NSArray*)componentDefinitions { - for (SpringComponentDefinition* definition in componentDefinitions) + for (TyphoonComponentDefinition* definition in componentDefinitions) { - for (SpringPropertyInjectedByValue* property in [definition propertiesInjectedByValue]) + for (TyphoonPropertyInjectedByValue* property in [definition propertiesInjectedByValue]) { if ([property.textValue hasPrefix:_prefix] && [property.textValue hasSuffix:_suffix]) { diff --git a/Source/Factory/SpringComponentFactory+InstanceBuilder.h b/Source/Factory/TyphoonComponentFactory+InstanceBuilder.h similarity index 73% rename from Source/Factory/SpringComponentFactory+InstanceBuilder.h rename to Source/Factory/TyphoonComponentFactory+InstanceBuilder.h index 3632e021a..285eaec05 100644 --- a/Source/Factory/SpringComponentFactory+InstanceBuilder.h +++ b/Source/Factory/TyphoonComponentFactory+InstanceBuilder.h @@ -12,10 +12,10 @@ #import -#import "SpringComponentFactory.h" +#import "TyphoonComponentFactory.h" -@interface SpringComponentFactory (InstanceBuilder) +@interface TyphoonComponentFactory (InstanceBuilder) -- (id)buildInstanceWithDefinition:(SpringComponentDefinition*)definition; +- (id)buildInstanceWithDefinition:(TyphoonComponentDefinition*)definition; @end \ No newline at end of file diff --git a/Source/Factory/SpringComponentFactory+InstanceBuilder.m b/Source/Factory/TyphoonComponentFactory+InstanceBuilder.m similarity index 55% rename from Source/Factory/SpringComponentFactory+InstanceBuilder.m rename to Source/Factory/TyphoonComponentFactory+InstanceBuilder.m index c638c6d9f..fc923c96d 100644 --- a/Source/Factory/SpringComponentFactory+InstanceBuilder.m +++ b/Source/Factory/TyphoonComponentFactory+InstanceBuilder.m @@ -13,26 +13,26 @@ #import -#import "SpringComponentFactory+InstanceBuilder.h" -#import "SpringComponentDefinition.h" -#import "SpringParameterInjectedByReference.h" -#import "SpringComponentInitializer.h" -#import "SpringPropertyInjectedByReference.h" -#import "SpringTypeDescriptor.h" -#import "SpringTypeConverter.h" -#import "SpringTypeConverterRegistry.h" -#import "SpringPropertyInjectedByValue.h" -#import "SpringPropertyInjectionDelegate.h" -#import "SpringParameterInjectedByValue.h" -#import "SpringPrimitiveTypeConverter.h" - - -@implementation SpringComponentFactory (InstanceBuilder) +#import "TyphoonComponentFactory+InstanceBuilder.h" +#import "TyphoonComponentDefinition.h" +#import "TyphoonParameterInjectedByReference.h" +#import "TyphoonComponentInitializer.h" +#import "TyphoonPropertyInjectedByReference.h" +#import "TyphoonTypeDescriptor.h" +#import "TyphonTypeConverter.h" +#import "TyphoonTypeConverterRegistry.h" +#import "TyphoonPropertyInjectedByValue.h" +#import "TyphoonPropertyInjectionDelegate.h" +#import "TyphoonParameterInjectedByValue.h" +#import "TyphoonPrimitiveTypeConverter.h" + + +@implementation TyphoonComponentFactory (InstanceBuilder) /* ========================================================== Interface Methods ========================================================= */ -- (id)buildInstanceWithDefinition:(SpringComponentDefinition*)definition +- (id)buildInstanceWithDefinition:(TyphoonComponentDefinition*)definition { - id instance; + id instance; if (definition.factoryComponent) { @@ -62,33 +62,33 @@ - (id)buildInstanceWithDefinition:(SpringComponentDefinition*)definition /* ============================================================ Private Methods ========================================================= */ -- (id)invokeInitializerOn:(id)instanceOrClass withDefinition:(SpringComponentDefinition*)definition +- (id)invokeInitializerOn:(id)instanceOrClass withDefinition:(TyphoonComponentDefinition*)definition { NSInvocation* invocation = [definition.initializer asInvocationFor:instanceOrClass]; - for (id parameter in [definition.initializer injectedParameters]) + for (id parameter in [definition.initializer injectedParameters]) { - if (parameter.type == SpringParameterInjectedByReferenceType) + if (parameter.type == TyphoonParameterInjectedByReferenceType) { - SpringParameterInjectedByReference* byReference = (SpringParameterInjectedByReference*) parameter; + TyphoonParameterInjectedByReference* byReference = (TyphoonParameterInjectedByReference*) parameter; id reference = [self componentForKey:byReference.reference]; [invocation setArgument:&reference atIndex:parameter.index + 2]; } - else if (parameter.type == SpringParameterInjectedByValueType) + else if (parameter.type == TyphoonParameterInjectedByValueType) { - SpringParameterInjectedByValue* byValue = (SpringParameterInjectedByValue*) parameter; + TyphoonParameterInjectedByValue* byValue = (TyphoonParameterInjectedByValue*) parameter; if (byValue.classOrProtocol) { - SpringTypeDescriptor* descriptor = [SpringTypeDescriptor descriptorWithClassOrProtocol:byValue.classOrProtocol]; - id converter = [[SpringTypeConverterRegistry shared] converterFor:descriptor]; + TyphoonTypeDescriptor* descriptor = [TyphoonTypeDescriptor descriptorWithClassOrProtocol:byValue.classOrProtocol]; + id converter = [[TyphoonTypeConverterRegistry shared] converterFor:descriptor]; id converted = [converter convert:byValue.value]; [invocation setArgument:&converted atIndex:parameter.index + 2]; } else { - SpringPrimitiveTypeConverter* converter = [[SpringTypeConverterRegistry shared] primitiveTypeConverter]; - SpringTypeDescriptor* descriptor = [byValue resolveTypeWith:instanceOrClass]; + TyphoonPrimitiveTypeConverter* converter = [[TyphoonTypeConverterRegistry shared] primitiveTypeConverter]; + TyphoonTypeDescriptor* descriptor = [byValue resolveTypeWith:instanceOrClass]; void* converted = [converter convert:byValue.value requiredType:descriptor]; [invocation setArgument:&converted atIndex:parameter.index + 2]; } @@ -103,13 +103,13 @@ - (id)invokeInitializerOn:(id)instanceOrClass withDefinition:(SpringComponentDef /* ====================================================================================================================================== */ #pragma mark - Property Injection -- (void)injectPropertyDependenciesOn:(id )instance withDefinition:(SpringComponentDefinition*)definition +- (void)injectPropertyDependenciesOn:(id )instance withDefinition:(TyphoonComponentDefinition*)definition { [self doBeforePropertyInjectionOn:instance withDefinition:definition]; - for (id property in [definition injectedProperties]) + for (id property in [definition injectedProperties]) { - SpringTypeDescriptor* typeDescriptor = [instance typeForPropertyWithName:property.name]; + TyphoonTypeDescriptor* typeDescriptor = [instance typeForPropertyWithName:property.name]; if (typeDescriptor == nil) { [NSException raise:NSInvalidArgumentException @@ -122,11 +122,11 @@ - (void)injectPropertyDependenciesOn:(id )instance [self doAfterPropertyInjectionOn:instance withDefinition:definition]; } -- (void)doBeforePropertyInjectionOn:(id )instance withDefinition:(SpringComponentDefinition*)definition +- (void)doBeforePropertyInjectionOn:(id )instance withDefinition:(TyphoonComponentDefinition*)definition { - if ([instance conformsToProtocol:@protocol(SpringPropertyInjectionDelegate)]) + if ([instance conformsToProtocol:@protocol(TyphoonPropertyInjectionDelegate)]) { - [(id ) instance beforePropertiesSet]; + [(id ) instance beforePropertiesSet]; } if ([instance respondsToSelector:definition.beforePropertyInjection]) { @@ -134,42 +134,42 @@ - (void)doBeforePropertyInjectionOn:(id )instance w } } -- (void)doPropertyInjection:(id )instance property:(id )property - typeDescriptor:(SpringTypeDescriptor*)typeDescriptor +- (void)doPropertyInjection:(id )instance property:(id )property + typeDescriptor:(TyphoonTypeDescriptor*)typeDescriptor { - if (property.type == SpringPropertyInjectionByTypeType) + if (property.type == TyphoonPropertyInjectionByTypeType) { id reference = [self componentForType:[typeDescriptor classOrProtocol]]; objc_msgSend(instance, [instance setterForPropertyWithName:property.name], reference, nil); } - else if (property.type == SpringPropertyInjectionByReferenceType) + else if (property.type == TyphoonPropertyInjectionByReferenceType) { - id reference = [self componentForKey:((SpringPropertyInjectedByReference*) property).reference]; + id reference = [self componentForKey:((TyphoonPropertyInjectedByReference*) property).reference]; objc_msgSend(instance, [instance setterForPropertyWithName:property.name], reference, nil); } - else if (property.type == SpringPropertyInjectionByValueType) + else if (property.type == TyphoonPropertyInjectionByValueType) { - SpringPropertyInjectedByValue* valueProperty = (SpringPropertyInjectedByValue*) property; + TyphoonPropertyInjectedByValue* valueProperty = (TyphoonPropertyInjectedByValue*) property; if (typeDescriptor.isPrimitive) { - SpringPrimitiveTypeConverter* converter = [[SpringTypeConverterRegistry shared] primitiveTypeConverter]; + TyphoonPrimitiveTypeConverter* converter = [[TyphoonTypeConverterRegistry shared] primitiveTypeConverter]; void* converted = [converter convert:valueProperty.textValue requiredType:typeDescriptor]; objc_msgSend(instance, [instance setterForPropertyWithName:property.name], converted, nil); } else { - id converter = [[SpringTypeConverterRegistry shared] converterFor:typeDescriptor]; + id converter = [[TyphoonTypeConverterRegistry shared] converterFor:typeDescriptor]; id converted = [converter convert:valueProperty.textValue]; objc_msgSend(instance, [instance setterForPropertyWithName:property.name], converted, nil); } } } -- (void)doAfterPropertyInjectionOn:(id )instance withDefinition:(SpringComponentDefinition*)definition +- (void)doAfterPropertyInjectionOn:(id )instance withDefinition:(TyphoonComponentDefinition*)definition { - if ([instance conformsToProtocol:@protocol(SpringPropertyInjectionDelegate)]) + if ([instance conformsToProtocol:@protocol(TyphoonPropertyInjectionDelegate)]) { - [(id ) instance afterPropertiesSet]; + [(id ) instance afterPropertiesSet]; } if ([instance respondsToSelector:definition.afterPropertyInjection]) { diff --git a/Source/Factory/SpringComponentFactory.h b/Source/Factory/TyphoonComponentFactory.h similarity index 76% rename from Source/Factory/SpringComponentFactory.h rename to Source/Factory/TyphoonComponentFactory.h index 8e98ea1ba..d7fc35033 100644 --- a/Source/Factory/SpringComponentFactory.h +++ b/Source/Factory/TyphoonComponentFactory.h @@ -14,14 +14,14 @@ #import -#import "SpringComponentFactoryMutator.h" -@class SpringComponentDefinition; +#import "TyphoonComponentFactoryMutator.h" +@class TyphoonComponentDefinition; /** * This is the base class for for all spring component factories. Although, it could be used as-is, the intention is to use a -* sub-class like SpringXmlComponentFactory. +* sub-class like TyphoonXmlComponentFactory. */ -@interface SpringComponentFactory : NSObject +@interface TyphoonComponentFactory : NSObject { NSMutableArray* _registry; NSMutableDictionary* _singletons; @@ -35,12 +35,12 @@ /** * Returns the default component factory, if one has been set. (See makeDefault ). */ -+ (SpringComponentFactory*)defaultFactory; ++ (TyphoonComponentFactory*)defaultFactory; /** -* Sets a given instance of SpringComponentFactory, as the default factory so that it can be retrieved later with: +* Sets a given instance of TyphoonComponentFactory, as the default factory so that it can be retrieved later with: - [SpringComponentFactory defaultFactory]; + [TyphoonComponentFactory defaultFactory]; */ - (void)makeDefault; @@ -48,7 +48,7 @@ /** * Registers a component into the factory. Components can be declared in any order, the container will work out how to resolve them. */ -- (void) register:(SpringComponentDefinition*)definition; +- (void) register:(TyphoonComponentDefinition*)definition; /** * Returns an an instance of the component matching the supplied class or protocol. For example: @@ -69,6 +69,6 @@ - (NSArray*)registry; -- (void)attachMutator:(id)mutator; +- (void)attachMutator:(id)mutator; @end \ No newline at end of file diff --git a/Source/Factory/SpringComponentFactory.m b/Source/Factory/TyphoonComponentFactory.m similarity index 79% rename from Source/Factory/SpringComponentFactory.m rename to Source/Factory/TyphoonComponentFactory.m index 3dae3d1f4..6119ebd1c 100644 --- a/Source/Factory/SpringComponentFactory.m +++ b/Source/Factory/TyphoonComponentFactory.m @@ -11,25 +11,24 @@ #import -#import "SpringComponentFactory.h" -#import "SpringComponentDefinition.h" -#import "SpringComponentFactory+InstanceBuilder.h" -#import "SpringComponentFactoryMutator.h" +#import "TyphoonComponentFactory.h" +#import "TyphoonComponentDefinition.h" +#import "TyphoonComponentFactory+InstanceBuilder.h" -@interface SpringComponentDefinition (SpringComponentFactory) +@interface TyphoonComponentDefinition (SpringComponentFactory) @property(nonatomic, strong) NSString* key; @end -@implementation SpringComponentFactory +@implementation TyphoonComponentFactory -static SpringComponentFactory* defaultFactory; +static TyphoonComponentFactory* defaultFactory; /* =========================================================== Class Methods ============================================================ */ -+ (SpringComponentFactory*)defaultFactory ++ (TyphoonComponentFactory*)defaultFactory { return defaultFactory; } @@ -51,17 +50,13 @@ - (id)init /* ========================================================== Interface Methods ========================================================= */ -- (void)register:(SpringComponentDefinition*)definition +- (void)register:(TyphoonComponentDefinition*)definition { + NSLog(@"Registering: %@", definition); if ([self definitionForKey:definition.key]) { [NSException raise:NSInvalidArgumentException format:@"Key '%@' is already registered.", definition.key]; } - if ([definition.key length] == 0) - { - NSString* uuidStr = [[NSProcessInfo processInfo] globallyUniqueString]; - definition.key = [NSString stringWithFormat:@"%@%@", NSStringFromClass(definition.type), uuidStr]; - } [_registry addObject:definition]; } @@ -85,7 +80,7 @@ - (NSArray*)allComponentsForType:(id)classOrProtocol NSMutableArray* results = [[NSMutableArray alloc] init]; BOOL isClass = class_isMetaClass(object_getClass(classOrProtocol)); - for (SpringComponentDefinition* definition in _registry) + for (TyphoonComponentDefinition* definition in _registry) { if (isClass) { @@ -113,7 +108,7 @@ - (id)componentForKey:(NSString*)key { [self performMutations]; [self assertNotCircularDependency:key]; - SpringComponentDefinition* definition = [self definitionForKey:key]; + TyphoonComponentDefinition* definition = [self definitionForKey:key]; if (!definition) { [NSException raise:NSInvalidArgumentException format:@"No component matching id '%@'.", key]; @@ -155,9 +150,9 @@ - (NSString*)description /* ============================================================ Private Methods ========================================================= */ -- (id)objectForDefinition:(SpringComponentDefinition*)definition +- (id)objectForDefinition:(TyphoonComponentDefinition*)definition { - if (definition.lifecycle == SpringComponentLifeCycleSingleton) + if (definition.lifecycle == TyphoonComponentLifeCycleSingleton) { return [self singletonForKey:definition]; } @@ -167,7 +162,7 @@ - (id)objectForDefinition:(SpringComponentDefinition*)definition } } -- (id)singletonForKey:(SpringComponentDefinition*)definition +- (id)singletonForKey:(TyphoonComponentDefinition*)definition { @synchronized (self) { @@ -182,9 +177,9 @@ - (id)singletonForKey:(SpringComponentDefinition*)definition } } -- (SpringComponentDefinition*)definitionForKey:(NSString*)key +- (TyphoonComponentDefinition*)definitionForKey:(NSString*)key { - for (SpringComponentDefinition* definition in _registry) + for (TyphoonComponentDefinition* definition in _registry) { if ([definition.key isEqualToString:key]) { @@ -205,14 +200,17 @@ - (void)assertNotCircularDependency:(NSString*)key - (void)performMutations { - if (!_hasPerformedMutations) + @synchronized (self) { - NSLog(@"Running mutators. . . %@", _mutators); - for (id mutator in _mutators) + if (!_hasPerformedMutations) { - [mutator mutateComponentDefinitionsIfRequired:_registry]; + NSLog(@"Running mutators. . . %@", _mutators); + for (id mutator in _mutators) + { + [mutator mutateComponentDefinitionsIfRequired:_registry]; + } + _hasPerformedMutations = YES; } - _hasPerformedMutations = YES; } } diff --git a/Source/Factory/Xml/SpringRXMLElement+SpringXmlComponentFactory.h b/Source/Factory/Xml/TyphoonRXMLElement+XmlComponentFactory.h similarity index 54% rename from Source/Factory/Xml/SpringRXMLElement+SpringXmlComponentFactory.h rename to Source/Factory/Xml/TyphoonRXMLElement+XmlComponentFactory.h index 067344fb9..c76c6f17f 100644 --- a/Source/Factory/Xml/SpringRXMLElement+SpringXmlComponentFactory.h +++ b/Source/Factory/Xml/TyphoonRXMLElement+XmlComponentFactory.h @@ -12,20 +12,20 @@ #import -#import "SpringRXMLElement.h" +#import "TyphoonRXMLElement.h" -@class SpringComponentDefinition; -@protocol SpringInjectedProperty; -@class SpringComponentInitializer; -@protocol SpringInjectedParameter; +@class TyphoonComponentDefinition; +@protocol TyphoonInjectedProperty; +@class TyphoonComponentInitializer; +@protocol TyphoonInjectedParameter; -@interface SpringRXMLElement (SpringXmlComponentFactory) +@interface TyphoonRXMLElement (XmlComponentFactory) -- (SpringComponentDefinition*)asComponentDefinition; +- (TyphoonComponentDefinition*)asComponentDefinition; -- (id)asInjectedProperty; +- (id)asInjectedProperty; -- (SpringComponentInitializer*)asInitializer; +- (TyphoonComponentInitializer*)asInitializer; diff --git a/Source/Factory/Xml/SpringRXMLElement+SpringXmlComponentFactory.m b/Source/Factory/Xml/TyphoonRXMLElement+XmlComponentFactory.m similarity index 70% rename from Source/Factory/Xml/SpringRXMLElement+SpringXmlComponentFactory.m rename to Source/Factory/Xml/TyphoonRXMLElement+XmlComponentFactory.m index f26edf075..005da8066 100644 --- a/Source/Factory/Xml/SpringRXMLElement+SpringXmlComponentFactory.m +++ b/Source/Factory/Xml/TyphoonRXMLElement+XmlComponentFactory.m @@ -11,17 +11,17 @@ -#import "SpringRXMLElement+SpringXmlComponentFactory.h" -#import "SpringComponentDefinition.h" -#import "SpringInjectedProperty.h" -#import "SpringPropertyInjectedByReference.h" -#import "SpringPropertyInjectedByValue.h" -#import "SpringPropertyInjectedByType.h" -#import "SpringComponentInitializer.h" +#import "TyphoonRXMLElement+XmlComponentFactory.h" +#import "TyphoonComponentDefinition.h" +#import "TyphoonInjectedProperty.h" +#import "TyphoonPropertyInjectedByReference.h" +#import "TyphoonPropertyInjectedByValue.h" +#import "TyphoonPropertyInjectedByType.h" +#import "TyphoonComponentInitializer.h" -@implementation SpringRXMLElement (SpringXmlComponentFactory) +@implementation TyphoonRXMLElement (XmlComponentFactory) -- (SpringComponentDefinition*)asComponentDefinition +- (TyphoonComponentDefinition*)asComponentDefinition { [self assertTagName:@"component"]; Class clazz = NSClassFromString([self attribute:@"class"]); @@ -31,7 +31,7 @@ - (SpringComponentDefinition*)asComponentDefinition } NSString* key = [self attribute:@"key"]; NSString* factory = [self attributeOrNilIfEmpty:@"factory-component"]; - SpringComponentDefinition* definition = [[SpringComponentDefinition alloc] initWithClazz:clazz key:key factoryComponent:factory]; + TyphoonComponentDefinition* definition = [[TyphoonComponentDefinition alloc] initWithClass:clazz key:key factoryComponent:factory]; [definition setBeforePropertyInjection:NSSelectorFromString([self attribute:@"before-property-injection"])]; [definition setAfterPropertyInjection:NSSelectorFromString([self attribute:@"after-property-injection"])]; @@ -41,7 +41,7 @@ - (SpringComponentDefinition*)asComponentDefinition } -- (id )asInjectedProperty +- (id )asInjectedProperty { [self assertTagName:@"property"]; @@ -49,7 +49,7 @@ - (SpringComponentDefinition*)asComponentDefinition NSString* referenceName = [self attribute:@"ref"]; NSString* value = [self attribute:@"value"]; - id injectedProperty = nil; + id injectedProperty = nil; if (referenceName && value) { [NSException raise:NSInvalidArgumentException format:@"Ambigous - both reference and value attributes are set. Can only be one."]; @@ -61,27 +61,27 @@ - (SpringComponentDefinition*)asComponentDefinition else if ([referenceName length] > 0) { - injectedProperty = [[SpringPropertyInjectedByReference alloc] initWithName:propertyName reference:referenceName]; + injectedProperty = [[TyphoonPropertyInjectedByReference alloc] initWithName:propertyName reference:referenceName]; } else if (value) { - injectedProperty = [[SpringPropertyInjectedByValue alloc] initWithName:propertyName value:value]; + injectedProperty = [[TyphoonPropertyInjectedByValue alloc] initWithName:propertyName value:value]; } else { - injectedProperty = [[SpringPropertyInjectedByType alloc] initWithName:propertyName]; + injectedProperty = [[TyphoonPropertyInjectedByType alloc] initWithName:propertyName]; } return injectedProperty; } -- (SpringComponentInitializer*)asInitializer +- (TyphoonComponentInitializer*)asInitializer { [self assertTagName:@"initializer"]; SEL selector = NSSelectorFromString([self attribute:@"selector"]); - SpringComponentInitializerIsClassMethod isClassMethod = [self handleIsClassMethod:[self attribute:@"is-class-method"]]; - SpringComponentInitializer* initializer = [[SpringComponentInitializer alloc] initWithSelector:selector isClassMethod:isClassMethod]; + TyphoonComponentInitializerIsClassMethod isClassMethod = [self handleIsClassMethod:[self attribute:@"is-class-method"]]; + TyphoonComponentInitializer* initializer = [[TyphoonComponentInitializer alloc] initWithSelector:selector isClassMethod:isClassMethod]; - [self iterate:@"*" usingBlock:^(SpringRXMLElement* child) + [self iterate:@"*" usingBlock:^(TyphoonRXMLElement* child) { if ([[child tag] isEqualToString:@"argument"]) { @@ -108,16 +108,16 @@ - (void)assertTagName:(NSString*)tagName } } -- (void)setScopeForDefinition:(SpringComponentDefinition*)definition withStringValue:(NSString*)scope; +- (void)setScopeForDefinition:(TyphoonComponentDefinition*)definition withStringValue:(NSString*)scope; { if ([scope isEqualToString:@"singleton"]) { - [definition setLifecycle:SpringComponentLifeCycleSingleton]; + [definition setLifecycle:TyphoonComponentLifeCycleSingleton]; } else if ([scope isEqualToString:@"prototype"]) { - [definition setLifecycle:SpringComponentLifeCyclePrototype]; + [definition setLifecycle:TyphoonComponentLifeCyclePrototype]; } else if ([scope length] > 0) { @@ -127,9 +127,9 @@ - (void)setScopeForDefinition:(SpringComponentDefinition*)definition withStringV -- (void)parseComponentDefinitionChildren:(SpringComponentDefinition*)componentDefinition +- (void)parseComponentDefinitionChildren:(TyphoonComponentDefinition*)componentDefinition { - [self iterate:@"*" usingBlock:^(SpringRXMLElement* child) + [self iterate:@"*" usingBlock:^(TyphoonRXMLElement* child) { if ([[child tag] isEqualToString:@"property"]) { @@ -151,7 +151,7 @@ - (void)parseComponentDefinitionChildren:(SpringComponentDefinition*)componentDe }]; } -- (void)setArgumentOnInitializer:(SpringComponentInitializer*)initializer withChildTag:(SpringRXMLElement*)child +- (void)setArgumentOnInitializer:(TyphoonComponentInitializer*)initializer withChildTag:(TyphoonRXMLElement*)child { NSString* name = [child attribute:@"parameterName"]; NSString* reference = [child attribute:@"ref"]; @@ -177,19 +177,19 @@ - (void)setArgumentOnInitializer:(SpringComponentInitializer*)initializer withCh } } -- (SpringComponentInitializerIsClassMethod)handleIsClassMethod:(NSString*)isClassMethodString +- (TyphoonComponentInitializerIsClassMethod)handleIsClassMethod:(NSString*)isClassMethodString { if ([[isClassMethodString lowercaseString] isEqualToString:@"yes"] || [[isClassMethodString lowercaseString] isEqualToString:@"true"]) { - return SpringComponentInitializerIsClassMethodYes; + return TyphoonComponentInitializerIsClassMethodYes; } else if ([[isClassMethodString lowercaseString] isEqualToString:@"no"] || [[isClassMethodString lowercaseString] isEqualToString:@"no"]) { - return SpringComponentInitializerIsClassMethodNo; + return TyphoonComponentInitializerIsClassMethodNo; } else { - return SpringComponentInitializerIsClassMethodGuess; + return TyphoonComponentInitializerIsClassMethodGuess; } } diff --git a/Source/Factory/Xml/SpringRXMLElement.h b/Source/Factory/Xml/TyphoonRXMLElement.h similarity index 89% rename from Source/Factory/Xml/SpringRXMLElement.h rename to Source/Factory/Xml/TyphoonRXMLElement.h index 42ec88cb7..8f6ef87c2 100644 --- a/Source/Factory/Xml/SpringRXMLElement.h +++ b/Source/Factory/Xml/TyphoonRXMLElement.h @@ -1,5 +1,5 @@ // ================================================================================================ -// SpringRXMLElement.h +// TyphoonRXMLElement+XmlComponentFactory.h // Fast processing of XML files // // ================================================================================================ @@ -34,7 +34,7 @@ #import #import -@interface SpringRXMLElement : NSObject +@interface TyphoonRXMLElement : NSObject { xmlDocPtr doc_; xmlNodePtr node_; @@ -63,16 +63,16 @@ - (double)attributeAsDouble:(NSString *)attributeName; - (double)attributeAsDouble:(NSString *)attributeName inNamespace:(NSString *)ns; -- (SpringRXMLElement*)child:(NSString *)tag; -- (SpringRXMLElement*)child:(NSString *)tag inNamespace:(NSString *)ns; +- (TyphoonRXMLElement*)child:(NSString *)tag; +- (TyphoonRXMLElement*)child:(NSString *)tag inNamespace:(NSString *)ns; - (NSArray *)children:(NSString *)tag; - (NSArray *)children:(NSString *)tag inNamespace:(NSString *)ns; - (NSArray *)childrenWithRootXPath:(NSString *)xpath; -- (void)iterate:(NSString *)query usingBlock:(void (^)(SpringRXMLElement*))blk; -- (void)iterateWithRootXPath:(NSString *)xpath usingBlock:(void (^)(SpringRXMLElement*))blk; -- (void)iterateElements:(NSArray *)elements usingBlock:(void (^)(SpringRXMLElement*))blk; +- (void)iterate:(NSString *)query usingBlock:(void (^)(TyphoonRXMLElement*))blk; +- (void)iterateWithRootXPath:(NSString *)xpath usingBlock:(void (^)(TyphoonRXMLElement*))blk; +- (void)iterateElements:(NSArray *)elements usingBlock:(void (^)(TyphoonRXMLElement*))blk; @property (nonatomic, readonly) NSString *tag; @property (nonatomic, readonly) NSString *text; @@ -82,5 +82,5 @@ @end -typedef void (^RXMLBlock)(SpringRXMLElement*element); +typedef void (^RXMLBlock)(TyphoonRXMLElement*element); diff --git a/Source/Factory/Xml/SpringRXMLElement.m b/Source/Factory/Xml/TyphoonRXMLElement.m similarity index 89% rename from Source/Factory/Xml/SpringRXMLElement.m rename to Source/Factory/Xml/TyphoonRXMLElement.m index 340d3f632..fa2b72de4 100644 --- a/Source/Factory/Xml/SpringRXMLElement.m +++ b/Source/Factory/Xml/TyphoonRXMLElement.m @@ -1,5 +1,5 @@ // ================================================================================================ -// SpringRXMLElement.m +// TyphoonRXMLElement+XmlComponentFactory.m // Fast processing of XML files // // ================================================================================================ @@ -28,7 +28,7 @@ // ================================================================================================ // -#import "SpringRXMLElement.h" +#import "TyphoonRXMLElement.h" // macros for supporting ARC/NON-ARC without need for a branch @@ -42,7 +42,7 @@ #define SAFE_ARC_SUPER_DEALLOC() ([super dealloc]) #endif -@implementation SpringRXMLElement +@implementation TyphoonRXMLElement - (id)initFromXMLString:(NSString *)xmlString encoding:(NSStringEncoding)encoding { if ((self = [super init])) { @@ -144,27 +144,27 @@ - (id)initFromXMLNode:(xmlNodePtr)node { } + (id)elementFromXMLString:(NSString *)attributeXML_ encoding:(NSStringEncoding)encoding { - return SAFE_ARC_AUTORELEASE([[SpringRXMLElement alloc] initFromXMLString:attributeXML_ encoding:encoding]); + return SAFE_ARC_AUTORELEASE([[TyphoonRXMLElement alloc] initFromXMLString:attributeXML_ encoding:encoding]); } + (id)elementFromXMLFile:(NSString *)filename { - return SAFE_ARC_AUTORELEASE([[SpringRXMLElement alloc] initFromXMLFile:filename]); + return SAFE_ARC_AUTORELEASE([[TyphoonRXMLElement alloc] initFromXMLFile:filename]); } + (id)elementFromXMLFilename:(NSString *)filename fileExtension:(NSString *)extension { - return SAFE_ARC_AUTORELEASE([[SpringRXMLElement alloc] initFromXMLFile:filename fileExtension:extension]); + return SAFE_ARC_AUTORELEASE([[TyphoonRXMLElement alloc] initFromXMLFile:filename fileExtension:extension]); } + (id)elementFromURL:(NSURL *)url { - return SAFE_ARC_AUTORELEASE([[SpringRXMLElement alloc] initFromURL:url]); + return SAFE_ARC_AUTORELEASE([[TyphoonRXMLElement alloc] initFromURL:url]); } + (id)elementFromXMLData:(NSData *)data { - return SAFE_ARC_AUTORELEASE([[SpringRXMLElement alloc] initFromXMLData:data]); + return SAFE_ARC_AUTORELEASE([[TyphoonRXMLElement alloc] initFromXMLData:data]); } + (id)elementFromXMLNode:(xmlNodePtr)node { - return SAFE_ARC_AUTORELEASE([[SpringRXMLElement alloc] initFromXMLNode:node]); + return SAFE_ARC_AUTORELEASE([[TyphoonRXMLElement alloc] initFromXMLNode:node]); } - (NSString *)description { @@ -242,7 +242,7 @@ - (BOOL)isValid { #pragma mark - -- (SpringRXMLElement*)child:(NSString *)tag { +- (TyphoonRXMLElement*)child:(NSString *)tag { NSArray *components = [tag componentsSeparatedByString:@"."]; xmlNodePtr cur = node_; @@ -273,13 +273,13 @@ - (SpringRXMLElement*)child:(NSString *)tag { } if (cur) { - return [SpringRXMLElement elementFromXMLNode:cur]; + return [TyphoonRXMLElement elementFromXMLNode:cur]; } return nil; } -- (SpringRXMLElement*)child:(NSString *)tag inNamespace:(NSString *)ns { +- (TyphoonRXMLElement*)child:(NSString *)tag inNamespace:(NSString *)ns { NSArray *components = [tag componentsSeparatedByString:@"."]; xmlNodePtr cur = node_; const xmlChar *namespaceC = (const xmlChar *)[ns cStringUsingEncoding:NSUTF8StringEncoding]; @@ -311,7 +311,7 @@ - (SpringRXMLElement*)child:(NSString *)tag inNamespace:(NSString *)ns { } if (cur) { - return [SpringRXMLElement elementFromXMLNode:cur]; + return [TyphoonRXMLElement elementFromXMLNode:cur]; } return nil; @@ -324,7 +324,7 @@ - (NSArray *)children:(NSString *)tag { while (cur != nil) { if (cur->type == XML_ELEMENT_NODE && !xmlStrcmp(cur->name, tagC)) { - [children addObject:[SpringRXMLElement elementFromXMLNode:cur]]; + [children addObject:[TyphoonRXMLElement elementFromXMLNode:cur]]; } cur = cur->next; @@ -341,7 +341,7 @@ - (NSArray *)children:(NSString *)tag inNamespace:(NSString *)ns { while (cur != nil) { if (cur->type == XML_ELEMENT_NODE && !xmlStrcmp(cur->name, tagC) && !xmlStrcmp(cur->ns->href, namespaceC)) { - [children addObject:[SpringRXMLElement elementFromXMLNode:cur]]; + [children addObject:[TyphoonRXMLElement elementFromXMLNode:cur]]; } cur = cur->next; @@ -375,7 +375,7 @@ - (NSArray *)childrenWithRootXPath:(NSString *)xpath { NSMutableArray *resultNodes = [NSMutableArray array]; for (NSInteger i = 0; i < nodes->nodeNr; i++) { - SpringRXMLElement*element = [SpringRXMLElement elementFromXMLNode:nodes->nodeTab[i]]; + TyphoonRXMLElement*element = [TyphoonRXMLElement elementFromXMLNode:nodes->nodeTab[i]]; if (element != NULL) { [resultNodes addObject:element]; @@ -390,7 +390,7 @@ - (NSArray *)childrenWithRootXPath:(NSString *)xpath { #pragma mark - -- (void)iterate:(NSString *)query usingBlock:(void (^)(SpringRXMLElement*))blk { +- (void)iterate:(NSString *)query usingBlock:(void (^)(TyphoonRXMLElement*))blk { // check for a query if (!query) { return; @@ -411,7 +411,7 @@ - (void)iterate:(NSString *)query usingBlock:(void (^)(SpringRXMLElement*))blk { // midstream do { if (cur->type == XML_ELEMENT_NODE) { - SpringRXMLElement*element = [SpringRXMLElement elementFromXMLNode:cur]; + TyphoonRXMLElement*element = [TyphoonRXMLElement elementFromXMLNode:cur]; NSString *restOfQuery = [[components subarrayWithRange:NSMakeRange(i + 1, components.count - i - 1)] componentsJoinedByString:@"."]; [element iterate:restOfQuery usingBlock:blk]; } @@ -444,7 +444,7 @@ - (void)iterate:(NSString *)query usingBlock:(void (^)(SpringRXMLElement*))blk { do { if (cur->type == XML_ELEMENT_NODE) { - SpringRXMLElement*element = [SpringRXMLElement elementFromXMLNode:cur]; + TyphoonRXMLElement*element = [TyphoonRXMLElement elementFromXMLNode:cur]; blk(element); } @@ -463,13 +463,13 @@ - (void)iterate:(NSString *)query usingBlock:(void (^)(SpringRXMLElement*))blk { } } -- (void)iterateWithRootXPath:(NSString *)xpath usingBlock:(void (^)(SpringRXMLElement*))blk { +- (void)iterateWithRootXPath:(NSString *)xpath usingBlock:(void (^)(TyphoonRXMLElement*))blk { NSArray *children = [self childrenWithRootXPath:xpath]; [self iterateElements:children usingBlock:blk]; } -- (void)iterateElements:(NSArray *)elements usingBlock:(void (^)(SpringRXMLElement*))blk { - for (SpringRXMLElement*iElement in elements) { +- (void)iterateElements:(NSArray *)elements usingBlock:(void (^)(TyphoonRXMLElement*))blk { + for (TyphoonRXMLElement*iElement in elements) { blk(iElement); } } diff --git a/Source/Factory/Xml/SpringXmlComponentFactory.h b/Source/Factory/Xml/TyphoonXmlComponentFactory.h similarity index 86% rename from Source/Factory/Xml/SpringXmlComponentFactory.h rename to Source/Factory/Xml/TyphoonXmlComponentFactory.h index e83dc6fa9..f41ed97b3 100644 --- a/Source/Factory/Xml/SpringXmlComponentFactory.h +++ b/Source/Factory/Xml/TyphoonXmlComponentFactory.h @@ -13,10 +13,10 @@ #import -#import "SpringComponentFactory.h" +#import "TyphoonComponentFactory.h" -@interface SpringXmlComponentFactory : SpringComponentFactory +@interface TyphoonXmlComponentFactory : TyphoonComponentFactory { NSMutableArray* _resourceNames; } diff --git a/Source/Factory/Xml/SpringXmlComponentFactory.m b/Source/Factory/Xml/TyphoonXmlComponentFactory.m similarity index 78% rename from Source/Factory/Xml/SpringXmlComponentFactory.m rename to Source/Factory/Xml/TyphoonXmlComponentFactory.m index 22812892f..46ce0c0ef 100644 --- a/Source/Factory/Xml/SpringXmlComponentFactory.m +++ b/Source/Factory/Xml/TyphoonXmlComponentFactory.m @@ -10,12 +10,12 @@ //////////////////////////////////////////////////////////////////////////////// -#import "SpringXmlComponentFactory.h" -#import "SpringBundleResource.h" -#import "SpringRXMLElement+SpringXmlComponentFactory.h" +#import "TyphoonXmlComponentFactory.h" +#import "TyphoonBundleResource.h" +#import "TyphoonRXMLElement+XmlComponentFactory.h" -@implementation SpringXmlComponentFactory +@implementation TyphoonXmlComponentFactory /* ============================================================ Initializers ============================================================ */ - (id)initWithConfigFileName:(NSString*)configFileName @@ -50,10 +50,10 @@ - (void)parseComponentDefinitions { for (NSString* resourceName in _resourceNames) { - NSString* xmlString = [[SpringBundleResource withName:resourceName] asString]; - SpringRXMLElement* element = [SpringRXMLElement elementFromXMLString:xmlString encoding:NSUTF8StringEncoding]; + NSString* xmlString = [[TyphoonBundleResource withName:resourceName] asString]; + TyphoonRXMLElement* element = [TyphoonRXMLElement elementFromXMLString:xmlString encoding:NSUTF8StringEncoding]; - [element iterate:@"*" usingBlock:^(SpringRXMLElement* child) + [element iterate:@"*" usingBlock:^(TyphoonRXMLElement* child) { if ([[child tag] isEqualToString:@"component"]) { diff --git a/Source/Info-iOS.plist b/Source/Info-iOS.plist new file mode 100644 index 000000000..647f1be22 --- /dev/null +++ b/Source/Info-iOS.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + AppsQuick.ly.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + NSPrincipalClass + + + diff --git a/Source/Spring.h b/Source/Spring.h deleted file mode 100644 index f42d8c764..000000000 --- a/Source/Spring.h +++ /dev/null @@ -1,26 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// JASPER BLUES -// Copyright 2013 Jasper Blues -// All Rights Reserved. -// -// NOTICE: Jasper Blues permits you to use, modify, and distribute this file -// in accordance with the terms of the license agreement accompanying it. -// -//////////////////////////////////////////////////////////////////////////////// - -#import "SpringComponentDefinition.h" -#import "SpringComponentDefinition+BlockBuilders.h" -#import "SpringComponentInitializer.h" -#import "SpringPropertyPlaceholderConfigurer.h" -#import "SpringResource.h" -#import "SpringBundleResource.h" -#import "SpringComponentFactory.h" -#import "SpringComponentFactory+InstanceBuilder.h" -#import "SpringXmlComponentFactory.h" -#import "SpringComponentFactoryMutator.h" -#import "SpringRXMLElement+SpringXmlComponentFactory.h" -#import "SpringRXMLElement.h" -#import "SpringTestUtils.h" - - diff --git a/Source/Swizzle/.DS_Store b/Source/Swizzle/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..98a2d855734e6043f6b6bf46a2a540dc21f546d2 GIT binary patch literal 6148 zcmeHKF-`+P4D>>ZNNG}1Zb^m24^~kqLP+HcUM%6zj$er1>-Pqb* zY@h$Q>b7^AZo5GR|K19I{^5qvG1l_|>-~V`R0Sy@1*Cu!kOKc$0rYIzbQY*61*Cu! z_*Q`5hYBaQ#6HkJ9SA(WbA3XjVeEGaV9j|;>;tg^D?tSYwd56}1ReRBbuF + +@interface NSObject (JRSwizzle) + ++ (BOOL)jr_swizzleMethod:(SEL)origSel_ withMethod:(SEL)altSel_ error:(NSError**)error_; ++ (BOOL)jr_swizzleClassMethod:(SEL)origSel_ withClassMethod:(SEL)altSel_ error:(NSError**)error_; + +@end diff --git a/Source/Swizzle/JRSwizzle.m b/Source/Swizzle/JRSwizzle.m new file mode 100644 index 000000000..4e582bf5a --- /dev/null +++ b/Source/Swizzle/JRSwizzle.m @@ -0,0 +1,134 @@ +// JRSwizzle.m semver:1.0 +// Copyright (c) 2007-2011 Jonathan 'Wolf' Rentzsch: http://rentzsch.com +// Some rights reserved: http://opensource.org/licenses/MIT +// https://github.com/rentzsch/jrswizzle + +#import "JRSwizzle.h" + +#if TARGET_OS_IPHONE + #import + #import +#else + #import +#endif + +#define SetNSErrorFor(FUNC, ERROR_VAR, FORMAT,...) \ + if (ERROR_VAR) { \ + NSString *errStr = [NSString stringWithFormat:@"%s: " FORMAT,FUNC,##__VA_ARGS__]; \ + *ERROR_VAR = [NSError errorWithDomain:@"NSCocoaErrorDomain" \ + code:-1 \ + userInfo:[NSDictionary dictionaryWithObject:errStr forKey:NSLocalizedDescriptionKey]]; \ + } +#define SetNSError(ERROR_VAR, FORMAT,...) SetNSErrorFor(__func__, ERROR_VAR, FORMAT, ##__VA_ARGS__) + +#if OBJC_API_VERSION >= 2 +#define GetClass(obj) object_getClass(obj) +#else +#define GetClass(obj) (obj ? obj->isa : Nil) +#endif + +@implementation NSObject (JRSwizzle) + ++ (BOOL)jr_swizzleMethod:(SEL)origSel_ withMethod:(SEL)altSel_ error:(NSError**)error_ { +#if OBJC_API_VERSION >= 2 + Method origMethod = class_getInstanceMethod(self, origSel_); + if (!origMethod) { +#if TARGET_OS_IPHONE + SetNSError(error_, @"original method %@ not found for class %@", NSStringFromSelector(origSel_), [self class]); +#else + SetNSError(error_, @"original method %@ not found for class %@", NSStringFromSelector(origSel_), [self className]); +#endif + return NO; + } + + Method altMethod = class_getInstanceMethod(self, altSel_); + if (!altMethod) { +#if TARGET_OS_IPHONE + SetNSError(error_, @"alternate method %@ not found for class %@", NSStringFromSelector(altSel_), [self class]); +#else + SetNSError(error_, @"alternate method %@ not found for class %@", NSStringFromSelector(altSel_), [self className]); +#endif + return NO; + } + + class_addMethod(self, + origSel_, + class_getMethodImplementation(self, origSel_), + method_getTypeEncoding(origMethod)); + class_addMethod(self, + altSel_, + class_getMethodImplementation(self, altSel_), + method_getTypeEncoding(altMethod)); + + method_exchangeImplementations(class_getInstanceMethod(self, origSel_), class_getInstanceMethod(self, altSel_)); + return YES; +#else + // Scan for non-inherited methods. + Method directOriginalMethod = NULL, directAlternateMethod = NULL; + + void *iterator = NULL; + struct objc_method_list *mlist = class_nextMethodList(self, &iterator); + while (mlist) { + int method_index = 0; + for (; method_index < mlist->method_count; method_index++) { + if (mlist->method_list[method_index].method_name == origSel_) { + assert(!directOriginalMethod); + directOriginalMethod = &mlist->method_list[method_index]; + } + if (mlist->method_list[method_index].method_name == altSel_) { + assert(!directAlternateMethod); + directAlternateMethod = &mlist->method_list[method_index]; + } + } + mlist = class_nextMethodList(self, &iterator); + } + + // If either method is inherited, copy it up to the target class to make it non-inherited. + if (!directOriginalMethod || !directAlternateMethod) { + Method inheritedOriginalMethod = NULL, inheritedAlternateMethod = NULL; + if (!directOriginalMethod) { + inheritedOriginalMethod = class_getInstanceMethod(self, origSel_); + if (!inheritedOriginalMethod) { + SetNSError(error_, @"original method %@ not found for class %@", NSStringFromSelector(origSel_), [self className]); + return NO; + } + } + if (!directAlternateMethod) { + inheritedAlternateMethod = class_getInstanceMethod(self, altSel_); + if (!inheritedAlternateMethod) { + SetNSError(error_, @"alternate method %@ not found for class %@", NSStringFromSelector(altSel_), [self className]); + return NO; + } + } + + int hoisted_method_count = !directOriginalMethod && !directAlternateMethod ? 2 : 1; + struct objc_method_list *hoisted_method_list = malloc(sizeof(struct objc_method_list) + (sizeof(struct objc_method)*(hoisted_method_count-1))); + hoisted_method_list->obsolete = NULL; // soothe valgrind - apparently ObjC runtime accesses this value and it shows as uninitialized in valgrind + hoisted_method_list->method_count = hoisted_method_count; + Method hoisted_method = hoisted_method_list->method_list; + + if (!directOriginalMethod) { + bcopy(inheritedOriginalMethod, hoisted_method, sizeof(struct objc_method)); + directOriginalMethod = hoisted_method++; + } + if (!directAlternateMethod) { + bcopy(inheritedAlternateMethod, hoisted_method, sizeof(struct objc_method)); + directAlternateMethod = hoisted_method; + } + class_addMethods(self, hoisted_method_list); + } + + // Swizzle. + IMP temp = directOriginalMethod->method_imp; + directOriginalMethod->method_imp = directAlternateMethod->method_imp; + directAlternateMethod->method_imp = temp; + + return YES; +#endif +} + ++ (BOOL)jr_swizzleClassMethod:(SEL)origSel_ withClassMethod:(SEL)altSel_ error:(NSError**)error_ { + return [GetClass((id)self) jr_swizzleMethod:origSel_ withMethod:altSel_ error:error_]; +} + +@end diff --git a/Source/TypeConversion/SpringTypeConverter.h b/Source/TypeConversion/TyphonTypeConverter.h similarity index 89% rename from Source/TypeConversion/SpringTypeConverter.h rename to Source/TypeConversion/TyphonTypeConverter.h index 1f60c4c57..3bba7f893 100644 --- a/Source/TypeConversion/SpringTypeConverter.h +++ b/Source/TypeConversion/TyphonTypeConverter.h @@ -12,12 +12,12 @@ #import -@class SpringTypeDescriptor; +@class TyphoonTypeDescriptor; /** * Declares a contract for converting configuration arguments to their required runtime type. */ -@protocol SpringTypeConverter +@protocol TyphonTypeConverter - (id)convert:(NSString*)stringValue; diff --git a/Source/TypeConversion/SpringNSURLTypeConverter.h b/Source/TypeConversion/TyphoonNSURLTypeConverter.h similarity index 81% rename from Source/TypeConversion/SpringNSURLTypeConverter.h rename to Source/TypeConversion/TyphoonNSURLTypeConverter.h index 0d741184d..af2dd61fa 100644 --- a/Source/TypeConversion/SpringNSURLTypeConverter.h +++ b/Source/TypeConversion/TyphoonNSURLTypeConverter.h @@ -12,8 +12,8 @@ #import -#import "SpringTypeConverter.h" +#import "TyphonTypeConverter.h" -@interface SpringNSURLTypeConverter : NSObject +@interface TyphoonNSURLTypeConverter : NSObject @end \ No newline at end of file diff --git a/Source/TypeConversion/SpringNSURLTypeConverter.m b/Source/TypeConversion/TyphoonNSURLTypeConverter.m similarity index 86% rename from Source/TypeConversion/SpringNSURLTypeConverter.m rename to Source/TypeConversion/TyphoonNSURLTypeConverter.m index 7c15240a3..b28bbba95 100644 --- a/Source/TypeConversion/SpringNSURLTypeConverter.m +++ b/Source/TypeConversion/TyphoonNSURLTypeConverter.m @@ -10,10 +10,10 @@ //////////////////////////////////////////////////////////////////////////////// -#import "SpringNSURLTypeConverter.h" +#import "TyphoonNSURLTypeConverter.h" -@implementation SpringNSURLTypeConverter +@implementation TyphoonNSURLTypeConverter - (id)convert:(NSString*)stringValue { diff --git a/Source/TypeConversion/SpringPassThroughTypeConverter.h b/Source/TypeConversion/TyphoonPassThroughTypeConverter.h similarity index 84% rename from Source/TypeConversion/SpringPassThroughTypeConverter.h rename to Source/TypeConversion/TyphoonPassThroughTypeConverter.h index 01a12a73d..fb52560cc 100644 --- a/Source/TypeConversion/SpringPassThroughTypeConverter.h +++ b/Source/TypeConversion/TyphoonPassThroughTypeConverter.h @@ -11,12 +11,12 @@ #import -#import "SpringTypeConverter.h" +#import "TyphonTypeConverter.h" /** * A 'type converter' for NSString and NSMutableString. */ -@interface SpringPassThroughTypeConverter : NSObject +@interface TyphoonPassThroughTypeConverter : NSObject @property (nonatomic, readonly) BOOL isMutable; diff --git a/Source/TypeConversion/SpringPassThroughTypeConverter.m b/Source/TypeConversion/TyphoonPassThroughTypeConverter.m similarity index 89% rename from Source/TypeConversion/SpringPassThroughTypeConverter.m rename to Source/TypeConversion/TyphoonPassThroughTypeConverter.m index 4541b4e65..8623dd237 100644 --- a/Source/TypeConversion/SpringPassThroughTypeConverter.m +++ b/Source/TypeConversion/TyphoonPassThroughTypeConverter.m @@ -10,11 +10,11 @@ //////////////////////////////////////////////////////////////////////////////// -#import "SpringPassThroughTypeConverter.h" -#import "SpringTypeDescriptor.h" +#import "TyphoonPassThroughTypeConverter.h" +#import "TyphoonTypeDescriptor.h" -@implementation SpringPassThroughTypeConverter +@implementation TyphoonPassThroughTypeConverter /* ============================================================ Initializers ============================================================ */ - (id)initWithIsMutable:(BOOL)isMutable diff --git a/Source/TypeConversion/SpringPrimitiveTypeConverter.h b/Source/TypeConversion/TyphoonPrimitiveTypeConverter.h similarity index 71% rename from Source/TypeConversion/SpringPrimitiveTypeConverter.h rename to Source/TypeConversion/TyphoonPrimitiveTypeConverter.h index 67cd16c3b..365461a5b 100644 --- a/Source/TypeConversion/SpringPrimitiveTypeConverter.h +++ b/Source/TypeConversion/TyphoonPrimitiveTypeConverter.h @@ -11,11 +11,11 @@ #import -#import "SpringTypeConverter.h" +#import "TyphonTypeConverter.h" -@interface SpringPrimitiveTypeConverter : NSObject +@interface TyphoonPrimitiveTypeConverter : NSObject -- (void*)convert:(NSString*)stringValue requiredType:(SpringTypeDescriptor*)typeDescriptor; +- (void*)convert:(NSString*)stringValue requiredType:(TyphoonTypeDescriptor*)typeDescriptor; @end \ No newline at end of file diff --git a/Source/TypeConversion/SpringPrimitiveTypeConverter.m b/Source/TypeConversion/TyphoonPrimitiveTypeConverter.m similarity index 67% rename from Source/TypeConversion/SpringPrimitiveTypeConverter.m rename to Source/TypeConversion/TyphoonPrimitiveTypeConverter.m index 44fd2a170..fb934f3fc 100644 --- a/Source/TypeConversion/SpringPrimitiveTypeConverter.m +++ b/Source/TypeConversion/TyphoonPrimitiveTypeConverter.m @@ -10,26 +10,26 @@ //////////////////////////////////////////////////////////////////////////////// -#import "SpringPrimitiveTypeConverter.h" -#import "SpringTypeDescriptor.h" +#import "TyphoonPrimitiveTypeConverter.h" +#import "TyphoonTypeDescriptor.h" -@implementation SpringPrimitiveTypeConverter +@implementation TyphoonPrimitiveTypeConverter -- (void*)convert:(NSString*)stringValue requiredType:(SpringTypeDescriptor*)typeDescriptor +- (void*)convert:(NSString*)stringValue requiredType:(TyphoonTypeDescriptor*)typeDescriptor { NSLog(@"Converting value: %@", stringValue); [self checkSupportedTypes:typeDescriptor]; - if (typeDescriptor.primitiveType == SpringPrimitiveTypeBoolean || typeDescriptor.primitiveType == SpringPrimitiveTypeChar) + if (typeDescriptor.primitiveType == TyphoonPrimitiveTypeBoolean || typeDescriptor.primitiveType == TyphoonPrimitiveTypeChar) { return (void*) [stringValue boolValue]; } - else if (typeDescriptor.primitiveType == SpringPrimitiveTypeString) + else if (typeDescriptor.primitiveType == TyphoonPrimitiveTypeString) { return (void*) [stringValue cStringUsingEncoding:NSUTF8StringEncoding]; } - else if (typeDescriptor.primitiveType == SpringPrimitiveTypeSelector) + else if (typeDescriptor.primitiveType == TyphoonPrimitiveTypeSelector) { return (void*) NSSelectorFromString(stringValue); } @@ -38,7 +38,7 @@ - (void*)convert:(NSString*)stringValue requiredType:(SpringTypeDescriptor*)type /* ============================================================ Private Methods ========================================================= */ -- (void)checkSupportedTypes:(SpringTypeDescriptor*)typeDescriptor +- (void)checkSupportedTypes:(TyphoonTypeDescriptor*)typeDescriptor { if (typeDescriptor.isArray) { @@ -48,82 +48,82 @@ - (void)checkSupportedTypes:(SpringTypeDescriptor*)typeDescriptor { [NSException raise:NSInvalidArgumentException format:@"Structure type can't be converted"]; } - else if (typeDescriptor.primitiveType == SpringPrimitiveTypeClass) + else if (typeDescriptor.primitiveType == TyphoonPrimitiveTypeClass) { [NSException raise:NSInvalidArgumentException format:@"Class type can't be converted. Consider using NSString"]; } - else if (typeDescriptor.primitiveType == SpringPrimitiveTypeDouble) + else if (typeDescriptor.primitiveType == TyphoonPrimitiveTypeDouble) { [NSException raise:NSInvalidArgumentException format:@"double type can't be converted. Consider using NSNumber."]; } - else if (typeDescriptor.primitiveType == SpringPrimitiveTypeFloat) + else if (typeDescriptor.primitiveType == TyphoonPrimitiveTypeFloat) { [NSException raise:NSInvalidArgumentException format:@"float type can't be converted. Consider using NSNumber."]; } - else if (typeDescriptor.primitiveType == SpringPrimitiveTypeBitField) + else if (typeDescriptor.primitiveType == TyphoonPrimitiveTypeBitField) { [NSException raise:NSInvalidArgumentException format:@"bitfield type can't be converted"]; } - else if (typeDescriptor.primitiveType == SpringPrimitiveTypeUnsignedChar) + else if (typeDescriptor.primitiveType == TyphoonPrimitiveTypeUnsignedChar) { [NSException raise:NSInvalidArgumentException format:@"unsigned char type can't be converted"]; } - else if (typeDescriptor.primitiveType == SpringPrimitiveTypeVoid) + else if (typeDescriptor.primitiveType == TyphoonPrimitiveTypeVoid) { [NSException raise:NSInvalidArgumentException format:@"void type can't be converted"]; } - else if (typeDescriptor.primitiveType == SpringPrimitiveTypeUnknown) + else if (typeDescriptor.primitiveType == TyphoonPrimitiveTypeUnknown) { [NSException raise:NSInvalidArgumentException format:@"unknown type can't be converted"]; } } -- (void*)convertNumericTypes:(NSString*)stringValue typeDescriptor:(SpringTypeDescriptor*)typeDescriptor +- (void*)convertNumericTypes:(NSString*)stringValue typeDescriptor:(TyphoonTypeDescriptor*)typeDescriptor { NSScanner* scanner = [[NSScanner alloc] initWithString:stringValue]; - if (typeDescriptor.primitiveType == SpringPrimitiveTypeInt) + if (typeDescriptor.primitiveType == TyphoonPrimitiveTypeInt) { int converted = 0; [scanner scanInt:&converted]; return (void*) converted; } - else if (typeDescriptor.primitiveType == SpringPrimitiveTypeUnsignedInt) + else if (typeDescriptor.primitiveType == TyphoonPrimitiveTypeUnsignedInt) { int converted = 0; [scanner scanInt:&converted]; return (void*) [[NSNumber numberWithUnsignedInt:converted] unsignedIntValue]; } - else if (typeDescriptor.primitiveType == SpringPrimitiveTypeShort) + else if (typeDescriptor.primitiveType == TyphoonPrimitiveTypeShort) { int converted = 0; [scanner scanInt:&converted]; return (void*) [[NSNumber numberWithInt:converted] shortValue]; } - else if (typeDescriptor.primitiveType == SpringPrimitiveTypeUnsignedShort) + else if (typeDescriptor.primitiveType == TyphoonPrimitiveTypeUnsignedShort) { int converted = 0; [scanner scanInt:&converted]; return (void*) [[NSNumber numberWithUnsignedInt:converted] unsignedShortValue]; } - else if (typeDescriptor.primitiveType == SpringPrimitiveTypeLong) + else if (typeDescriptor.primitiveType == TyphoonPrimitiveTypeLong) { long long converted = 0; [scanner scanLongLong:&converted]; return (void*) [[NSNumber numberWithLong:converted] longValue]; } - else if (typeDescriptor.primitiveType == SpringPrimitiveTypeUnsignedLong) + else if (typeDescriptor.primitiveType == TyphoonPrimitiveTypeUnsignedLong) { long long converted = 0; [scanner scanLongLong:&converted]; return (void*) [[NSNumber numberWithUnsignedLong:converted] unsignedLongValue]; } - else if (typeDescriptor.primitiveType == SpringPrimitiveTypeLongLong) + else if (typeDescriptor.primitiveType == TyphoonPrimitiveTypeLongLong) { long long converted = 0; [scanner scanLongLong:&converted]; return (void*) converted; } - else if (typeDescriptor.primitiveType == SpringPrimitiveTypeUnsignedLongLong) + else if (typeDescriptor.primitiveType == TyphoonPrimitiveTypeUnsignedLongLong) { long long converted = 0; [scanner scanLongLong:&converted]; diff --git a/Source/TypeConversion/SpringTypeConverterRegistry.h b/Source/TypeConversion/TyphoonTypeConverterRegistry.h similarity index 69% rename from Source/TypeConversion/SpringTypeConverterRegistry.h rename to Source/TypeConversion/TyphoonTypeConverterRegistry.h index b39b6cd08..a166f2846 100644 --- a/Source/TypeConversion/SpringTypeConverterRegistry.h +++ b/Source/TypeConversion/TyphoonTypeConverterRegistry.h @@ -12,39 +12,39 @@ #import -@protocol SpringTypeConverter; -@class SpringTypeDescriptor; -@class SpringPrimitiveTypeConverter; +@protocol TyphonTypeConverter; +@class TyphoonTypeDescriptor; +@class TyphoonPrimitiveTypeConverter; /** * Registry of type converters, with special treatment for primitives. */ -@interface SpringTypeConverterRegistry : NSObject +@interface TyphoonTypeConverterRegistry : NSObject { - SpringPrimitiveTypeConverter* _primitiveTypeConverter; + TyphoonPrimitiveTypeConverter* _primitiveTypeConverter; NSMutableDictionary* _typeConverters; } /** * Returns the shard/default registry instance used by the container. */ -+ (SpringTypeConverterRegistry*)shared; ++ (TyphoonTypeConverterRegistry*)shared; /** * Returns the type converter for the given type either a Class object or @protocol(SomeType). */ -- (id )converterFor:(id)classOrProtocol; +- (id )converterFor:(id)classOrProtocol; /** * Returns the type converter for primitives - BOOLS, ints, floats, etc. */ -- (SpringPrimitiveTypeConverter*)primitiveTypeConverter; +- (TyphoonPrimitiveTypeConverter*)primitiveTypeConverter; /** * Registers a converter for the given type (either a Class object or @protocol. If a converter exists for the type, * raises an exception. */ -- (void)register:(id)converter forClassOrProtocol:(id)classOrProtocol; +- (void)register:(id)converter forClassOrProtocol:(id)classOrProtocol; @end \ No newline at end of file diff --git a/Source/TypeConversion/SpringTypeConverterRegistry.m b/Source/TypeConversion/TyphoonTypeConverterRegistry.m similarity index 65% rename from Source/TypeConversion/SpringTypeConverterRegistry.m rename to Source/TypeConversion/TyphoonTypeConverterRegistry.m index 10d9f3e0d..25b27fce8 100644 --- a/Source/TypeConversion/SpringTypeConverterRegistry.m +++ b/Source/TypeConversion/TyphoonTypeConverterRegistry.m @@ -11,21 +11,21 @@ #import -#import "SpringTypeConverterRegistry.h" -#import "SpringTypeConverter.h" -#import "SpringTypeDescriptor.h" -#import "SpringPrimitiveTypeConverter.h" -#import "SpringPassThroughTypeConverter.h" -#import "SpringNSURLTypeConverter.h" +#import "TyphoonTypeConverterRegistry.h" +#import "TyphonTypeConverter.h" +#import "TyphoonTypeDescriptor.h" +#import "TyphoonPrimitiveTypeConverter.h" +#import "TyphoonPassThroughTypeConverter.h" +#import "TyphoonNSURLTypeConverter.h" -@implementation SpringTypeConverterRegistry +@implementation TyphoonTypeConverterRegistry /* =========================================================== Class Methods ============================================================ */ -+ (SpringTypeConverterRegistry*)shared ++ (TyphoonTypeConverterRegistry*)shared { static dispatch_once_t onceToken; - static SpringTypeConverterRegistry* instance; + static TyphoonTypeConverterRegistry* instance; dispatch_once(&onceToken, ^ { @@ -41,21 +41,21 @@ - (id)init if (self) { _typeConverters = [[NSMutableDictionary alloc] init]; - _primitiveTypeConverter = [[SpringPrimitiveTypeConverter alloc] init]; + _primitiveTypeConverter = [[TyphoonPrimitiveTypeConverter alloc] init]; - [self register:[[SpringPassThroughTypeConverter alloc] initWithIsMutable:NO] forClassOrProtocol:[NSString class]]; - [self register:[[SpringPassThroughTypeConverter alloc] initWithIsMutable:YES] forClassOrProtocol:[NSMutableString class]]; - [self register:[[SpringNSURLTypeConverter alloc] init] forClassOrProtocol:[NSURL class]]; + [self register:[[TyphoonPassThroughTypeConverter alloc] initWithIsMutable:NO] forClassOrProtocol:[NSString class]]; + [self register:[[TyphoonPassThroughTypeConverter alloc] initWithIsMutable:YES] forClassOrProtocol:[NSMutableString class]]; + [self register:[[TyphoonNSURLTypeConverter alloc] init] forClassOrProtocol:[NSURL class]]; } return self; } /* ========================================================== Interface Methods ========================================================= */ -- (id )converterFor:(id)classOrProtocol +- (id )converterFor:(id)classOrProtocol { - id converter = [_typeConverters objectForKey:[classOrProtocol classOrProtocol]]; + id converter = [_typeConverters objectForKey:[classOrProtocol classOrProtocol]]; if (!converter) { [NSException raise:NSInvalidArgumentException format:@"No type converter registered for type: '%@'.", @@ -65,12 +65,12 @@ - (id)init return converter; } -- (SpringPrimitiveTypeConverter*)primitiveTypeConverter +- (TyphoonPrimitiveTypeConverter*)primitiveTypeConverter { return _primitiveTypeConverter; } -- (void)register:(id )converter forClassOrProtocol:(id)classOrProtocol; +- (void)register:(id )converter forClassOrProtocol:(id)classOrProtocol; { if (!([_typeConverters objectForKey:classOrProtocol])) { diff --git a/Source/TypeConversion/SpringTypeDescriptor.h b/Source/TypeConversion/TyphoonTypeDescriptor.h similarity index 53% rename from Source/TypeConversion/SpringTypeDescriptor.h rename to Source/TypeConversion/TyphoonTypeDescriptor.h index d5d8281e8..110d9fda4 100644 --- a/Source/TypeConversion/SpringTypeDescriptor.h +++ b/Source/TypeConversion/TyphoonTypeDescriptor.h @@ -14,32 +14,32 @@ typedef enum { - SpringPrimitiveTypeUnknown, - SpringPrimitiveTypeChar, - SpringPrimitiveTypeInt, - SpringPrimitiveTypeShort, - SpringPrimitiveTypeLong, - SpringPrimitiveTypeLongLong, - SpringPrimitiveTypeUnsignedChar, - SpringPrimitiveTypeUnsignedInt, - SpringPrimitiveTypeUnsignedShort, - SpringPrimitiveTypeUnsignedLong, - SpringPrimitiveTypeUnsignedLongLong, - SpringPrimitiveTypeFloat, - SpringPrimitiveTypeDouble, - SpringPrimitiveTypeBoolean, - SpringPrimitiveTypeVoid, - SpringPrimitiveTypeString, - SpringPrimitiveTypeClass, - SpringPrimitiveTypeSelector, - SpringPrimitiveTypeBitField, -} SpringPrimitiveType; - - -@interface SpringTypeDescriptor : NSObject + TyphoonPrimitiveTypeUnknown, + TyphoonPrimitiveTypeChar, + TyphoonPrimitiveTypeInt, + TyphoonPrimitiveTypeShort, + TyphoonPrimitiveTypeLong, + TyphoonPrimitiveTypeLongLong, + TyphoonPrimitiveTypeUnsignedChar, + TyphoonPrimitiveTypeUnsignedInt, + TyphoonPrimitiveTypeUnsignedShort, + TyphoonPrimitiveTypeUnsignedLong, + TyphoonPrimitiveTypeUnsignedLongLong, + TyphoonPrimitiveTypeFloat, + TyphoonPrimitiveTypeDouble, + TyphoonPrimitiveTypeBoolean, + TyphoonPrimitiveTypeVoid, + TyphoonPrimitiveTypeString, + TyphoonPrimitiveTypeClass, + TyphoonPrimitiveTypeSelector, + TyphoonPrimitiveTypeBitField, +} TyphoonPrimitiveType; + + +@interface TyphoonTypeDescriptor : NSObject @property(nonatomic, readonly) BOOL isPrimitive; -@property(nonatomic, readonly) SpringPrimitiveType primitiveType; +@property(nonatomic, readonly) TyphoonPrimitiveType primitiveType; @property(nonatomic, readonly) Class metaClass; @property(nonatomic, readonly) Protocol* protocol; @property(nonatomic, readonly) BOOL isArray; @@ -48,9 +48,9 @@ typedef enum @property(nonatomic, readonly) BOOL isStructure; @property(nonatomic, strong, readonly) NSString* structureTypeName; -+ (SpringTypeDescriptor*)descriptorWithTypeCode:(NSString*)typeCode; ++ (TyphoonTypeDescriptor*)descriptorWithTypeCode:(NSString*)typeCode; -+ (SpringTypeDescriptor*)descriptorWithClassOrProtocol:(id)classOrProtocol; ++ (TyphoonTypeDescriptor*)descriptorWithClassOrProtocol:(id)classOrProtocol; - (id)initWithTypeCode:(NSString*)typeCode; diff --git a/Source/TypeConversion/SpringTypeDescriptor.m b/Source/TypeConversion/TyphoonTypeDescriptor.m similarity index 74% rename from Source/TypeConversion/SpringTypeDescriptor.m rename to Source/TypeConversion/TyphoonTypeDescriptor.m index 52ba46d87..1126ff684 100644 --- a/Source/TypeConversion/SpringTypeDescriptor.m +++ b/Source/TypeConversion/TyphoonTypeDescriptor.m @@ -12,7 +12,7 @@ #import -#import "SpringTypeDescriptor.h" +#import "TyphoonTypeDescriptor.h" @implementation NSDictionary (DeucePrimitiveType) @@ -24,31 +24,31 @@ + (NSDictionary*)dictionaryWithDeucePrimitiveTypesAsStrings dispatch_once(&onceToken, ^ { _deucePrimitiveTypesAsStrings = - [[NSDictionary alloc] initWithObjectsAndKeys:@(SpringPrimitiveTypeChar), @"c", @(SpringPrimitiveTypeInt), @"i", - @(SpringPrimitiveTypeShort), @"s", @(SpringPrimitiveTypeLong), @"l", - @(SpringPrimitiveTypeLongLong), @"q", @(SpringPrimitiveTypeUnsignedChar), @"C", - @(SpringPrimitiveTypeUnsignedInt), @"I", @(SpringPrimitiveTypeUnsignedShort), @"S", - @(SpringPrimitiveTypeUnsignedLong), @"L", - @(SpringPrimitiveTypeUnsignedLongLong), @"Q", @(SpringPrimitiveTypeFloat), @"f", - @(SpringPrimitiveTypeDouble), @"d", @(SpringPrimitiveTypeBoolean), @"B", - @(SpringPrimitiveTypeVoid), @"v", @(SpringPrimitiveTypeString), @"*", - @(SpringPrimitiveTypeClass), @"#", @(SpringPrimitiveTypeSelector), @":", - @(SpringPrimitiveTypeUnknown), @"?", nil]; + [[NSDictionary alloc] initWithObjectsAndKeys:@(TyphoonPrimitiveTypeChar), @"c", @(TyphoonPrimitiveTypeInt), @"i", + @(TyphoonPrimitiveTypeShort), @"s", @(TyphoonPrimitiveTypeLong), @"l", + @(TyphoonPrimitiveTypeLongLong), @"q", @(TyphoonPrimitiveTypeUnsignedChar), @"C", + @(TyphoonPrimitiveTypeUnsignedInt), @"I", @(TyphoonPrimitiveTypeUnsignedShort), @"S", + @(TyphoonPrimitiveTypeUnsignedLong), @"L", + @(TyphoonPrimitiveTypeUnsignedLongLong), @"Q", @(TyphoonPrimitiveTypeFloat), @"f", + @(TyphoonPrimitiveTypeDouble), @"d", @(TyphoonPrimitiveTypeBoolean), @"B", + @(TyphoonPrimitiveTypeVoid), @"v", @(TyphoonPrimitiveTypeString), @"*", + @(TyphoonPrimitiveTypeClass), @"#", @(TyphoonPrimitiveTypeSelector), @":", + @(TyphoonPrimitiveTypeUnknown), @"?", nil]; }); return _deucePrimitiveTypesAsStrings; } @end -@implementation SpringTypeDescriptor +@implementation TyphoonTypeDescriptor /* =========================================================== Class Methods ============================================================ */ -+ (SpringTypeDescriptor*)descriptorWithTypeCode:(NSString*)typeCode ++ (TyphoonTypeDescriptor*)descriptorWithTypeCode:(NSString*)typeCode { return [[[self class] alloc] initWithTypeCode:typeCode]; } -+ (SpringTypeDescriptor*)descriptorWithClassOrProtocol:(id)classOrProtocol; ++ (TyphoonTypeDescriptor*)descriptorWithClassOrProtocol:(id)classOrProtocol; { if (class_isMetaClass(object_getClass(classOrProtocol))) { @@ -163,9 +163,9 @@ - (NSString*)extractStructureInformation:(NSString*)typeCode return typeCode; } -- (SpringPrimitiveType)typeFromTypeCode:(NSString*)typeCode +- (TyphoonPrimitiveType)typeFromTypeCode:(NSString*)typeCode { - return (SpringPrimitiveType) [[[NSDictionary dictionaryWithDeucePrimitiveTypesAsStrings] objectForKey:typeCode] intValue]; + return (TyphoonPrimitiveType) [[[NSDictionary dictionaryWithDeucePrimitiveTypesAsStrings] objectForKey:typeCode] intValue]; } @end \ No newline at end of file diff --git a/Source/Typhoon.h b/Source/Typhoon.h new file mode 100644 index 000000000..4caca3063 --- /dev/null +++ b/Source/Typhoon.h @@ -0,0 +1,27 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// JASPER BLUES +// Copyright 2013 Jasper Blues +// All Rights Reserved. +// +// NOTICE: Jasper Blues permits you to use, modify, and distribute this file +// in accordance with the terms of the license agreement accompanying it. +// +//////////////////////////////////////////////////////////////////////////////// + +#import "TyphoonComponentDefinition.h" +#import "TyphoonComponentDefinition+BlockBuilders.h" +#import "TyphoonComponentInitializer.h" +#import "TyphoonPropertyPlaceholderConfigurer.h" +#import "TyphoonResource.h" +#import "TyphoonBundleResource.h" +#import "TyphoonComponentFactory.h" +#import "TyphoonComponentFactory+InstanceBuilder.h" +#import "TyphoonXmlComponentFactory.h" +#import "TyphoonComponentFactoryMutator.h" +#import "TyphoonRXMLElement+XmlComponentFactory.h" +#import "TyphoonRXMLElement.h" +#import "TyphoonTestUtils.h" + + + diff --git a/Source/Spring-Objective-C-Prefix.pch b/Source/Typhoon.pch similarity index 100% rename from Source/Spring-Objective-C-Prefix.pch rename to Source/Typhoon.pch diff --git a/Source/Utils/NSObject+SpringIntrospectionUtils.h b/Source/Utils/NSObject+TyphoonIntrospectionUtils.h similarity index 69% rename from Source/Utils/NSObject+SpringIntrospectionUtils.h rename to Source/Utils/NSObject+TyphoonIntrospectionUtils.h index b95505f2c..65b6d1b9d 100644 --- a/Source/Utils/NSObject+SpringIntrospectionUtils.h +++ b/Source/Utils/NSObject+TyphoonIntrospectionUtils.h @@ -13,16 +13,16 @@ #import -#import "SpringIntrospectiveNSObject.h" +#import "TyphoonIntrospectiveNSObject.h" -@class SpringTypeDescriptor; +@class TyphoonTypeDescriptor; -@interface NSObject (SpringIntrospectionUtils) +@interface NSObject (TyphoonIntrospectionUtils) /** -* Returns a Class object or `SpringTypeDescriptor` in the case of a primitive type. +* Returns a Class object or `TyphoonTypeDescriptor` in the case of a primitive type. */ -- (SpringTypeDescriptor*)typeForPropertyWithName:(NSString*)propertyName; +- (TyphoonTypeDescriptor*)typeForPropertyWithName:(NSString*)propertyName; - (SEL)setterForPropertyWithName:(NSString*)propertyName; diff --git a/Source/Utils/NSObject+SpringIntrospectionUtils.m b/Source/Utils/NSObject+TyphoonIntrospectionUtils.m similarity index 85% rename from Source/Utils/NSObject+SpringIntrospectionUtils.m rename to Source/Utils/NSObject+TyphoonIntrospectionUtils.m index c54d89db6..3b6884c09 100644 --- a/Source/Utils/NSObject+SpringIntrospectionUtils.m +++ b/Source/Utils/NSObject+TyphoonIntrospectionUtils.m @@ -13,15 +13,15 @@ #import -#import "SpringTypeDescriptor.h" -#import "SpringIntrospectionUtils.h" +#import "TyphoonTypeDescriptor.h" +#import "TyphoonIntrospectionUtils.h" -@implementation NSObject (SpringIntrospectionUtils) +@implementation NSObject (TyphoonIntrospectionUtils) -- (SpringTypeDescriptor*)typeForPropertyWithName:(NSString*)propertyName; +- (TyphoonTypeDescriptor*)typeForPropertyWithName:(NSString*)propertyName; { - SpringTypeDescriptor* typeDescriptor = nil; + TyphoonTypeDescriptor* typeDescriptor = nil; objc_property_t propertyReflection = class_getProperty([self class], [propertyName UTF8String]); if (propertyReflection) { @@ -42,7 +42,7 @@ - (SpringTypeDescriptor*)typeForPropertyWithName:(NSString*)propertyName; memcpy( buffer, attrs, len ); buffer[len] = '\0'; - typeDescriptor = [SpringTypeDescriptor descriptorWithTypeCode:[NSString stringWithCString:buffer encoding:NSUTF8StringEncoding]]; + typeDescriptor = [TyphoonTypeDescriptor descriptorWithTypeCode:[NSString stringWithCString:buffer encoding:NSUTF8StringEncoding]]; } return typeDescriptor; } @@ -91,7 +91,7 @@ - (NSArray*)parameterNamesForSelector:(SEL)selector - (NSArray*)typeCodesForSelector:(SEL)selector { - return [SpringIntrospectionUtils typeCodesForSelector:selector ofClass:[self class] isClassMethod:NO]; + return [TyphoonIntrospectionUtils typeCodesForSelector:selector ofClass:[self class] isClassMethod:NO]; } diff --git a/Source/Utils/Resource/SpringBundleResource.h b/Source/Utils/Resource/TyphoonBundleResource.h similarity index 81% rename from Source/Utils/Resource/SpringBundleResource.h rename to Source/Utils/Resource/TyphoonBundleResource.h index a98e67961..0846ba550 100644 --- a/Source/Utils/Resource/SpringBundleResource.h +++ b/Source/Utils/Resource/TyphoonBundleResource.h @@ -12,19 +12,19 @@ #import -#import "SpringResource.h" +#import "TyphoonResource.h" /** * Represents a resource within the application bundle. */ -@interface SpringBundleResource : NSObject +@interface TyphoonBundleResource : NSObject { NSString* _stringValue; } -+ (id)withName:(NSString*)name; ++ (id)withName:(NSString*)name; - (id)initWithStringValue:(NSString*)stringValue; diff --git a/Source/Utils/Resource/SpringBundleResource.m b/Source/Utils/Resource/TyphoonBundleResource.m similarity index 93% rename from Source/Utils/Resource/SpringBundleResource.m rename to Source/Utils/Resource/TyphoonBundleResource.m index d1ab904ce..164409fd7 100644 --- a/Source/Utils/Resource/SpringBundleResource.m +++ b/Source/Utils/Resource/TyphoonBundleResource.m @@ -10,13 +10,13 @@ //////////////////////////////////////////////////////////////////////////////// -#import "SpringBundleResource.h" +#import "TyphoonBundleResource.h" -@implementation SpringBundleResource +@implementation TyphoonBundleResource /* =========================================================== Class Methods ============================================================ */ -+ (id)withName:(NSString*)name { ++ (id)withName:(NSString*)name { NSString* contents; NSRange lastDot = [name rangeOfString:@"." options:NSBackwardsSearch]; diff --git a/Source/Utils/Resource/SpringResource.h b/Source/Utils/Resource/TyphoonResource.h similarity index 93% rename from Source/Utils/Resource/SpringResource.h rename to Source/Utils/Resource/TyphoonResource.h index a84b1f364..226c19926 100644 --- a/Source/Utils/Resource/SpringResource.h +++ b/Source/Utils/Resource/TyphoonResource.h @@ -13,7 +13,7 @@ #import -@protocol SpringResource +@protocol TyphoonResource /** * Returns the resource with the given name, as an NSString. diff --git a/Source/Utils/SpringIntrospectionUtils.h b/Source/Utils/TyphoonIntrospectionUtils.h similarity index 92% rename from Source/Utils/SpringIntrospectionUtils.h rename to Source/Utils/TyphoonIntrospectionUtils.h index 01e15ddfc..73705aaed 100644 --- a/Source/Utils/SpringIntrospectionUtils.h +++ b/Source/Utils/TyphoonIntrospectionUtils.h @@ -15,7 +15,7 @@ #import -@interface SpringIntrospectionUtils : NSObject +@interface TyphoonIntrospectionUtils : NSObject + (NSArray*)typeCodesForSelector:(SEL)selector ofClass:(Class)clazz isClassMethod:(BOOL)isClassMethod; diff --git a/Source/Utils/SpringIntrospectionUtils.m b/Source/Utils/TyphoonIntrospectionUtils.m similarity index 93% rename from Source/Utils/SpringIntrospectionUtils.m rename to Source/Utils/TyphoonIntrospectionUtils.m index 54909e3c3..bfe72e8e6 100644 --- a/Source/Utils/SpringIntrospectionUtils.m +++ b/Source/Utils/TyphoonIntrospectionUtils.m @@ -13,10 +13,10 @@ #import -#import "SpringIntrospectionUtils.h" +#import "TyphoonIntrospectionUtils.h" -@implementation SpringIntrospectionUtils +@implementation TyphoonIntrospectionUtils + (NSArray*)typeCodesForSelector:(SEL)selector ofClass:(Class)clazz isClassMethod:(BOOL)isClassMethod { diff --git a/Source/Utils/SpringIntrospectiveNSObject.h b/Source/Utils/TyphoonIntrospectiveNSObject.h similarity index 76% rename from Source/Utils/SpringIntrospectiveNSObject.h rename to Source/Utils/TyphoonIntrospectiveNSObject.h index 86699a85c..6d6bdad86 100644 --- a/Source/Utils/SpringIntrospectiveNSObject.h +++ b/Source/Utils/TyphoonIntrospectiveNSObject.h @@ -12,11 +12,11 @@ #import -@class SpringTypeDescriptor; +@class TyphoonTypeDescriptor; -@protocol SpringIntrospectiveNSObject +@protocol TyphoonIntrospectiveNSObject -- (SpringTypeDescriptor*)typeForPropertyWithName:(NSString*)propertyName; +- (TyphoonTypeDescriptor*)typeForPropertyWithName:(NSString*)propertyName; - (SEL)setterForPropertyWithName:(NSString*)propertyName; diff --git a/Source/Utils/SpringTestUtils.h b/Source/Utils/TyphoonTestUtils.h similarity index 100% rename from Source/Utils/SpringTestUtils.h rename to Source/Utils/TyphoonTestUtils.h diff --git a/Tests/Component/SpringComponentDefinitionTests.m b/Tests/Component/TyphoonComponentDefinitionTests.m similarity index 74% rename from Tests/Component/SpringComponentDefinitionTests.m rename to Tests/Component/TyphoonComponentDefinitionTests.m index 7bfe421a6..6b14fcd64 100644 --- a/Tests/Component/SpringComponentDefinitionTests.m +++ b/Tests/Component/TyphoonComponentDefinitionTests.m @@ -11,13 +11,13 @@ #import #import "Knight.h" -#import "Spring.h" +#import "Typhoon.h" -@interface SpringComponentDefinitionTests : SenTestCase +@interface TyphoonComponentDefinitionTests : SenTestCase @end -@implementation SpringComponentDefinitionTests +@implementation TyphoonComponentDefinitionTests - (void)setUp { @@ -35,7 +35,7 @@ - (void)tearDown - (void)test_allows_initialization_with_class_and_key_parameters { - SpringComponentDefinition* definition = [[SpringComponentDefinition alloc] initWithClazz:[Knight class] key:@"knight"]; + TyphoonComponentDefinition* definition = [[TyphoonComponentDefinition alloc] initWithClass:[Knight class] key:@"knight"]; assertThat(definition.key, equalTo(@"knight")); assertThat(definition.type, equalTo([Knight class])); @@ -45,7 +45,7 @@ - (void)test_prevents_initialization_without_supplying_required_parameters { @try { - SpringComponentDefinition* definition = [[SpringComponentDefinition alloc] init]; + TyphoonComponentDefinition* definition = [[TyphoonComponentDefinition alloc] init]; NSLog(@"Def: %@", definition); STFail(@"Should've thrown exception"); } @@ -56,7 +56,7 @@ - (void)test_prevents_initialization_without_supplying_required_parameters @try { - SpringComponentDefinition* definition = [[SpringComponentDefinition alloc] initWithClazz:nil key:nil]; + TyphoonComponentDefinition* definition = [[TyphoonComponentDefinition alloc] initWithClass:nil key:nil]; NSLog(@"Def: %@", definition); STFail(@"Should've thrown exception"); } diff --git a/Tests/Factory/Mutator/PropertyConfigurer/SpringPropertyPlaceholderConfigurerTests.m b/Tests/Factory/Mutator/PropertyConfigurer/TyphoonPropertyPlaceholderConfigurerTests.m similarity index 63% rename from Tests/Factory/Mutator/PropertyConfigurer/SpringPropertyPlaceholderConfigurerTests.m rename to Tests/Factory/Mutator/PropertyConfigurer/TyphoonPropertyPlaceholderConfigurerTests.m index 0605e4c47..eb5abfe82 100644 --- a/Tests/Factory/Mutator/PropertyConfigurer/SpringPropertyPlaceholderConfigurerTests.m +++ b/Tests/Factory/Mutator/PropertyConfigurer/TyphoonPropertyPlaceholderConfigurerTests.m @@ -10,21 +10,21 @@ //////////////////////////////////////////////////////////////////////////////// #import -#import "Spring.h" +#import "Typhoon.h" #import "Knight.h" -@interface SpringPropertyPlaceholderConfigurerTests : SenTestCase +@interface TyphoonPropertyPlaceholderConfigurerTests : SenTestCase @end -@implementation SpringPropertyPlaceholderConfigurerTests +@implementation TyphoonPropertyPlaceholderConfigurerTests { - SpringPropertyPlaceholderConfigurer* _configurer; + TyphoonPropertyPlaceholderConfigurer* _configurer; } - (void)setUp { - _configurer = [[SpringPropertyPlaceholderConfigurer alloc] init]; - [_configurer usePropertyStyleResource:[SpringBundleResource withName:@"SomeProperties.properties"]]; + _configurer = [[TyphoonPropertyPlaceholderConfigurer alloc] init]; + [_configurer usePropertyStyleResource:[TyphoonBundleResource withName:@"SomeProperties.properties"]]; } - (void)test_parses_property_name_value_pairs @@ -35,8 +35,8 @@ - (void)test_parses_property_name_value_pairs - (void)test_mutates_property_values { - SpringComponentFactory* factory = [[SpringComponentFactory alloc] init]; - SpringComponentDefinition* knightDefinition = [[SpringComponentDefinition alloc] initWithClazz:[Knight class] key:@"knight"]; + TyphoonComponentFactory* factory = [[TyphoonComponentFactory alloc] init]; + TyphoonComponentDefinition* knightDefinition = [[TyphoonComponentDefinition alloc] initWithClass:[Knight class] key:@"knight"]; [knightDefinition injectProperty:@"damselsRescued" withValueAsText:@"${damsels.rescued}"]; [factory register:knightDefinition]; diff --git a/Tests/Factory/SpringComponentFactoryTests.m b/Tests/Factory/SpringComponentFactoryTests.m deleted file mode 100644 index 6fb63a127..000000000 --- a/Tests/Factory/SpringComponentFactoryTests.m +++ /dev/null @@ -1,161 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// JASPER BLUES -// Copyright 2012 Jasper Blues -// All Rights Reserved. -// -// NOTICE: Jasper Blues permits you to use, modify, and distribute this file -// in accordance with the terms of the license agreement accompanying it. -// -//////////////////////////////////////////////////////////////////////////////// - -#import -#import "Spring.h" - -#import "Knight.h" -#import "CampaignQuest.h" -#import "CavalryMan.h" -#import "Champion.h" - - -static NSString * const DEFAULT_QUEST = @"quest"; - -@interface SpringComponentFactoryTests : SenTestCase -@end - -@implementation SpringComponentFactoryTests -{ - SpringComponentFactory* _componentFactory; -} - -- (void)setUp -{ - _componentFactory = [[SpringComponentFactory alloc] init]; -} - -/* ====================================================================================================================================== */ -#pragma mark - Dependencies resolved by reference - -- (void)test_objectForKey_returns_singleton_with_initializer_dependencies -{ - -[_componentFactory register:[SpringComponentDefinition definitionWithClass:[Knight class] - initializer:^(SpringComponentInitializer* initializer) - { - initializer.selector = @selector(initWithQuest:); - [initializer injectParameterAtIndex:0 withReference:DEFAULT_QUEST]; - }]]; - -[_componentFactory register:[SpringComponentDefinition definitionWithClass:[CampaignQuest class] key:DEFAULT_QUEST]]; - -Knight* knight = [_componentFactory componentForType:[Knight class]]; - - assertThat(knight, notNilValue()); - assertThat(knight, instanceOf([Knight class])); - assertThat(knight.quest, notNilValue()); - - NSLog(@"Here's the knight: %@", knight); -} - -- (void)test_objectForKey_raises_exception_if_reference_does_not_exist -{ - SpringComponentDefinition* knightDefinition = [[SpringComponentDefinition alloc] initWithClazz:[Knight class] key:@"knight"]; - SpringComponentInitializer* knightInitializer = [[SpringComponentInitializer alloc] initWithSelector:@selector(initWithQuest:)]; - [knightInitializer injectParameterNamed:@"quest" withReference:@"quest"]; - [knightDefinition setInitializer:knightInitializer]; - [_componentFactory register:knightDefinition]; - - @try - { - Knight* knight = [_componentFactory componentForKey:@"knight"]; - NSLog(@"Knight: %@", knight); - STFail(@"Should have thrown exception"); - } - @catch (NSException* e) - { - assertThat([e description], equalTo(@"No component matching id 'quest'.")); - } -} - -/* ====================================================================================================================================== */ -#pragma mark - Dependencies resolved by type - -- (void)test_allObjectsForType -{ - SpringComponentDefinition* knightDefinition = [[SpringComponentDefinition alloc] initWithClazz:[Knight class] key:@"knight"]; - SpringComponentInitializer* knightInitializer = [[SpringComponentInitializer alloc] initWithSelector:@selector(initWithQuest:)]; - [knightInitializer injectParameterNamed:@"quest" withReference:@"quest"]; - [knightDefinition setInitializer:knightInitializer]; - [_componentFactory register:knightDefinition]; - - SpringComponentDefinition - * cavalryManDefinition = [[SpringComponentDefinition alloc] initWithClazz:[CavalryMan class] key:@"cavalryMan"]; - [_componentFactory register:cavalryManDefinition]; - - SpringComponentDefinition* questDefinition = [[SpringComponentDefinition alloc] initWithClazz:[CampaignQuest class] key:@"quest"]; - [_componentFactory register:questDefinition]; - - assertThat([_componentFactory allComponentsForType:[Knight class]], hasCountOf(2)); - assertThat([_componentFactory allComponentsForType:[CampaignQuest class]], hasCountOf(1)); - assertThat([_componentFactory allComponentsForType:@protocol(NSObject)], hasCountOf(3)); -} - -- (void)test_objectForType -{ - SpringComponentDefinition* knightDefinition = [[SpringComponentDefinition alloc] initWithClazz:[Knight class] key:@"knight"]; - SpringComponentInitializer* knightInitializer = [[SpringComponentInitializer alloc] initWithSelector:@selector(initWithQuest:)]; - [knightInitializer injectParameterNamed:@"quest" withReference:@"quest"]; - [knightDefinition setInitializer:knightInitializer]; - [_componentFactory register:knightDefinition]; - - SpringComponentDefinition - * cavalryManDefinition = [[SpringComponentDefinition alloc] initWithClazz:[CavalryMan class] key:@"cavalryMan"]; - [_componentFactory register:cavalryManDefinition]; - - SpringComponentDefinition* questDefinition = [[SpringComponentDefinition alloc] initWithClazz:[CampaignQuest class] key:@"quest"]; - [_componentFactory register:questDefinition]; - - assertThat([_componentFactory componentForType:[CavalryMan class]], notNilValue()); - - @try - { - Knight* knight = [_componentFactory componentForType:[Knight class]]; - NSLog(@"Here's the knight: %@", knight); - STFail(@"Should have thrown exception"); - } - @catch (NSException* e) - { - assertThat([e description], equalTo(@"More than one component is defined satisfying type: 'Knight'")); - } - - @try - { - Knight* knight = [_componentFactory componentForType:[Champion class]]; - NSLog(@"Here's the knight: %@", knight); - STFail(@"Should have thrown exception"); - } - @catch (NSException* e) - { - assertThat([e description], equalTo(@"No components defined which satisify type: 'Champion'")); - } -} - -- (void)test_objectForKey_returns_singleton_with_property_dependencies_resolved_by_type -{ - SpringComponentDefinition* knightDefinition = [[SpringComponentDefinition alloc] initWithClazz:[Knight class] key:@"knight"]; - [knightDefinition injectProperty:@"quest"]; - [_componentFactory register:knightDefinition]; - - SpringComponentDefinition* questDefinition = [[SpringComponentDefinition alloc] initWithClazz:[CampaignQuest class] key:@"quest"]; - [_componentFactory register:questDefinition]; - - Knight* knight = [_componentFactory componentForKey:@"knight"]; - - assertThat(knight, notNilValue()); - assertThat(knight, instanceOf([Knight class])); - assertThat(knight.quest, notNilValue()); - - NSLog(@"Here's the knight: %@", knight); -} - -@end \ No newline at end of file diff --git a/Tests/Factory/SpringComponentFactory+InstanceBuilderTests.m b/Tests/Factory/TyphoonComponentFactory+InstanceBuilderTests.m similarity index 69% rename from Tests/Factory/SpringComponentFactory+InstanceBuilderTests.m rename to Tests/Factory/TyphoonComponentFactory+InstanceBuilderTests.m index bd70906a2..a91bb0b98 100644 --- a/Tests/Factory/SpringComponentFactory+InstanceBuilderTests.m +++ b/Tests/Factory/TyphoonComponentFactory+InstanceBuilderTests.m @@ -11,10 +11,10 @@ #import #import -#import "Spring.h" +#import "Typhoon.h" #import "Knight.h" #import "CampaignQuest.h" -#import "SpringComponentInitializer.h" +#import "TyphoonComponentInitializer.h" @interface ComponentDefinition_InstanceBuilderTests : SenTestCase @@ -22,12 +22,12 @@ @interface ComponentDefinition_InstanceBuilderTests : SenTestCase @implementation ComponentDefinition_InstanceBuilderTests { - SpringComponentFactory* _componentFactory; + TyphoonComponentFactory* _componentFactory; } - (void)setUp { - _componentFactory = [[SpringComponentFactory alloc] init]; + _componentFactory = [[TyphoonComponentFactory alloc] init]; } /* ====================================================================================================================================== */ @@ -35,13 +35,13 @@ - (void)setUp - (void)test_injects_required_initializer_dependencies { - SpringComponentDefinition* knightDefinition = [[SpringComponentDefinition alloc] initWithClazz:[Knight class] key:@"knight"]; - SpringComponentInitializer* knightInitializer = [[SpringComponentInitializer alloc] initWithSelector:@selector(initWithQuest:)]; + TyphoonComponentDefinition* knightDefinition = [[TyphoonComponentDefinition alloc] initWithClass:[Knight class] key:@"knight"]; + TyphoonComponentInitializer* knightInitializer = [[TyphoonComponentInitializer alloc] initWithSelector:@selector(initWithQuest:)]; [knightInitializer injectParameterNamed:@"quest" withReference:@"quest"]; [knightDefinition setInitializer:knightInitializer]; [_componentFactory register:knightDefinition]; - SpringComponentDefinition* questDefinition = [[SpringComponentDefinition alloc] initWithClazz:[CampaignQuest class] key:@"quest"]; + TyphoonComponentDefinition* questDefinition = [[TyphoonComponentDefinition alloc] initWithClass:[CampaignQuest class] key:@"quest"]; [_componentFactory register:questDefinition]; Knight* knight = [_componentFactory buildInstanceWithDefinition:knightDefinition]; @@ -52,9 +52,9 @@ - (void)test_injects_required_initializer_dependencies - (void)test_injects_required_initializer_dependencies_with_factory_method { - SpringComponentDefinition* urlDefinition = [[SpringComponentDefinition alloc] initWithClazz:[NSURL class] key:@"url"]; - SpringComponentInitializer - * initializer = [[SpringComponentInitializer alloc] initWithSelector:@selector(URLWithString:) isClassMethod:YES]; + TyphoonComponentDefinition* urlDefinition = [[TyphoonComponentDefinition alloc] initWithClass:[NSURL class] key:@"url"]; + TyphoonComponentInitializer + * initializer = [[TyphoonComponentInitializer alloc] initWithSelector:@selector(URLWithString:) isClassMethod:YES]; [initializer injectParameterAt:0 withValueAsText:@"http://www.appsquick.ly" requiredTypeOrNil:[NSString class]]; [urlDefinition setInitializer:initializer]; [_componentFactory register:urlDefinition]; @@ -69,11 +69,11 @@ - (void)test_injects_required_initializer_dependencies_with_factory_method - (void)test_injects_required_property_dependencies { - SpringComponentDefinition* knightDefinition = [[SpringComponentDefinition alloc] initWithClazz:[Knight class] key:@"knight"]; + TyphoonComponentDefinition* knightDefinition = [[TyphoonComponentDefinition alloc] initWithClass:[Knight class] key:@"knight"]; [knightDefinition injectProperty:@"quest" withReference:@"quest"]; [_componentFactory register:knightDefinition]; - SpringComponentDefinition* questDefinition = [[SpringComponentDefinition alloc] initWithClazz:[CampaignQuest class] key:@"quest"]; + TyphoonComponentDefinition* questDefinition = [[TyphoonComponentDefinition alloc] initWithClass:[CampaignQuest class] key:@"quest"]; [_componentFactory register:questDefinition]; Knight* knight = [_componentFactory buildInstanceWithDefinition:knightDefinition]; @@ -84,11 +84,11 @@ - (void)test_injects_required_property_dependencies - (void)test_raises_exception_if_property_setter_does_not_exist { - SpringComponentDefinition* knightDefinition = [[SpringComponentDefinition alloc] initWithClazz:[Knight class] key:@"knight"]; + TyphoonComponentDefinition* knightDefinition = [[TyphoonComponentDefinition alloc] initWithClass:[Knight class] key:@"knight"]; [knightDefinition injectProperty:@"propertyThatDoesNotExist" withReference:@"quest"]; [_componentFactory register:knightDefinition]; - SpringComponentDefinition* questDefinition = [[SpringComponentDefinition alloc] initWithClazz:[CampaignQuest class] key:@"quest"]; + TyphoonComponentDefinition* questDefinition = [[TyphoonComponentDefinition alloc] initWithClass:[CampaignQuest class] key:@"quest"]; [_componentFactory register:questDefinition]; @try @@ -106,7 +106,7 @@ - (void)test_raises_exception_if_property_setter_does_not_exist - (void)test_injects_property_value_as_long { - SpringComponentDefinition* knightDefinition = [[SpringComponentDefinition alloc] initWithClazz:[Knight class] key:@"knight"]; + TyphoonComponentDefinition* knightDefinition = [[TyphoonComponentDefinition alloc] initWithClass:[Knight class] key:@"knight"]; [knightDefinition injectProperty:@"damselsRescued" withValueAsText:@"12"]; [_componentFactory register:knightDefinition]; @@ -116,9 +116,9 @@ - (void)test_injects_property_value_as_long - (void)test_injects_initializer_value_as_long { - SpringComponentDefinition* knightDefinition = [[SpringComponentDefinition alloc] initWithClazz:[Knight class] key:@"knight"]; - SpringComponentInitializer - * initializer = [[SpringComponentInitializer alloc] initWithSelector:@selector(initWithQuest:damselsRescued:) isClassMethod:NO]; + TyphoonComponentDefinition* knightDefinition = [[TyphoonComponentDefinition alloc] initWithClass:[Knight class] key:@"knight"]; + TyphoonComponentInitializer + * initializer = [[TyphoonComponentInitializer alloc] initWithSelector:@selector(initWithQuest:damselsRescued:) isClassMethod:NO]; [initializer injectParameterNamed:@"damselsRescued" withValueAsText:@"12" requiredTypeOrNil:nil]; [knightDefinition setInitializer:initializer]; @@ -135,7 +135,7 @@ - (void)test_raises_exception_if_property_has_no_setter { @try { - SpringComponentDefinition* knightDefinition = [[SpringComponentDefinition alloc] initWithClazz:[Knight class] key:@"knight"]; + TyphoonComponentDefinition* knightDefinition = [[TyphoonComponentDefinition alloc] initWithClass:[Knight class] key:@"knight"]; [knightDefinition injectProperty:@"propertyDoesNotExist" withReference:@"quest"]; [_componentFactory register:knightDefinition]; @@ -155,11 +155,11 @@ - (void)test_raises_exception_if_property_is_readonly { @try { - SpringComponentDefinition* knightDefinition = [[SpringComponentDefinition alloc] initWithClazz:[Knight class] key:@"knight"]; + TyphoonComponentDefinition* knightDefinition = [[TyphoonComponentDefinition alloc] initWithClass:[Knight class] key:@"knight"]; [knightDefinition injectProperty:@"readOnlyQuest" withReference:@"quest"]; [_componentFactory register:knightDefinition]; - SpringComponentDefinition* questDefinition = [[SpringComponentDefinition alloc] initWithClazz:[CampaignQuest class] key:@"quest"]; + TyphoonComponentDefinition* questDefinition = [[TyphoonComponentDefinition alloc] initWithClass:[CampaignQuest class] key:@"quest"]; [_componentFactory register:questDefinition]; Knight* knight = [_componentFactory componentForKey:@"knight"]; diff --git a/Tests/Factory/TyphoonComponentFactoryTests.m b/Tests/Factory/TyphoonComponentFactoryTests.m new file mode 100644 index 000000000..b795f117a --- /dev/null +++ b/Tests/Factory/TyphoonComponentFactoryTests.m @@ -0,0 +1,161 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// JASPER BLUES +// Copyright 2012 Jasper Blues +// All Rights Reserved. +// +// NOTICE: Jasper Blues permits you to use, modify, and distribute this file +// in accordance with the terms of the license agreement accompanying it. +// +//////////////////////////////////////////////////////////////////////////////// + +#import +#import "Typhoon.h" + +#import "Knight.h" +#import "CampaignQuest.h" +#import "CavalryMan.h" +#import "Champion.h" + + +static NSString* const DEFAULT_QUEST = @"quest"; + +@interface TyphoonComponentFactoryTests : SenTestCase +@end + +@implementation TyphoonComponentFactoryTests +{ + TyphoonComponentFactory* _componentFactory; +} + +- (void)setUp +{ + _componentFactory = [[TyphoonComponentFactory alloc] init]; +} + +/* ====================================================================================================================================== */ +#pragma mark - Dependencies resolved by reference + +- (void)test_objectForKey_returns_singleton_with_initializer_dependencies +{ + + [_componentFactory register:[TyphoonComponentDefinition withClass:[Knight class] + initialization:^(TyphoonComponentInitializer* initializer) + { + initializer.selector = @selector(initWithQuest:); + [initializer injectParameterAtIndex:0 withReference:DEFAULT_QUEST]; + }]]; + + [_componentFactory register:[TyphoonComponentDefinition withClass:[CampaignQuest class] key:DEFAULT_QUEST]]; + + Knight* knight = [_componentFactory componentForType:[Knight class]]; + + assertThat(knight, notNilValue()); + assertThat(knight, instanceOf([Knight class])); + assertThat(knight.quest, notNilValue()); + + NSLog(@"Here's the knight: %@", knight); +} + +- (void)test_objectForKey_raises_exception_if_reference_does_not_exist +{ + [_componentFactory register:[TyphoonComponentDefinition withClass:[Knight class] key:@"knight" + initialization:^(TyphoonComponentInitializer* initializer) + { + initializer.selector = @selector(initWithQuest:); + [initializer injectParameterAtIndex:0 withReference:DEFAULT_QUEST]; + }]]; + + @try + { + Knight* knight = [_componentFactory componentForKey:@"knight"]; + NSLog(@"Knight: %@", knight); + STFail(@"Should have thrown exception"); + } + @catch (NSException* e) + { + assertThat([e description], equalTo(@"No component matching id 'quest'.")); + } +} + +/* ====================================================================================================================================== */ +#pragma mark - Dependencies resolved by type + +- (void)test_allObjectsForType +{ + + [_componentFactory register:[TyphoonComponentDefinition withClass:[Knight class] key:@"knight" + initialization:^(TyphoonComponentInitializer* initializer) + { + [initializer setSelector:@selector(initWithQuest:)]; + [initializer injectParameterNamed:@"quest" withReference:@"quest"]; + }]]; + + [_componentFactory register:[TyphoonComponentDefinition withClass:[CavalryMan class] key:@"cavalryMan"]]; + [_componentFactory register:[TyphoonComponentDefinition withClass:[CampaignQuest class] key:@"quest"]]; + + assertThat([_componentFactory allComponentsForType:[Knight class]], hasCountOf(2)); + assertThat([_componentFactory allComponentsForType:[CampaignQuest class]], hasCountOf(1)); + assertThat([_componentFactory allComponentsForType:@protocol(NSObject)], hasCountOf(3)); +} + +- (void)test_objectForType +{ + + [_componentFactory register:[TyphoonComponentDefinition withClass:[Knight class] key:@"knight" + initialization:^(TyphoonComponentInitializer* initializer) + { + [initializer setSelector:@selector(initWithQuest:)]; + [initializer injectParameterNamed:@"quest" withReference:@"quest"]; + }]]; + + [_componentFactory register:[TyphoonComponentDefinition withClass:[CavalryMan class] key:@"cavalryMan"]]; + [_componentFactory register:[TyphoonComponentDefinition withClass:[CampaignQuest class] key:@"quest"]]; + + assertThat([_componentFactory componentForType:[CavalryMan class]], notNilValue()); + + @try + { + Knight* knight = [_componentFactory componentForType:[Knight class]]; + NSLog(@"Here's the knight: %@", knight); + STFail(@"Should have thrown exception"); + } + @catch (NSException* e) + { + assertThat([e description], equalTo(@"More than one component is defined satisfying type: 'Knight'")); + } + + @try + { + Knight* knight = [_componentFactory componentForType:[Champion class]]; + NSLog(@"Here's the knight: %@", knight); + STFail(@"Should have thrown exception"); + } + @catch (NSException* e) + { + assertThat([e description], equalTo(@"No components defined which satisify type: 'Champion'")); + } +} + +- (void)test_objectForKey_returns_singleton_with_property_dependencies_resolved_by_type +{ + + [_componentFactory register:[TyphoonComponentDefinition withClass:[Knight class] key:@"knight" + properties:^(TyphoonComponentDefinition* definition) + { + [definition injectProperty:@"quest"]; + [definition setLifecycle:TyphoonComponentLifeCyclePrototype]; + }]]; + + [_componentFactory register:[TyphoonComponentDefinition withClass:[CampaignQuest class] key:@"quest"]]; + + Knight* knight = [_componentFactory componentForKey:@"knight"]; + + assertThat(knight, notNilValue()); + assertThat(knight, instanceOf([Knight class])); + assertThat(knight.quest, notNilValue()); + + NSLog(@"Here's the knight: %@", knight); +} + +@end \ No newline at end of file diff --git a/Tests/Factory/Xml/RXMLElement+SpringXmlComponentFactoryTests.m b/Tests/Factory/Xml/RXMLElement+XmlComponentFactoryTests.m similarity index 72% rename from Tests/Factory/Xml/RXMLElement+SpringXmlComponentFactoryTests.m rename to Tests/Factory/Xml/RXMLElement+XmlComponentFactoryTests.m index 4c1529292..ac16b1417 100644 --- a/Tests/Factory/Xml/RXMLElement+SpringXmlComponentFactoryTests.m +++ b/Tests/Factory/Xml/RXMLElement+XmlComponentFactoryTests.m @@ -10,21 +10,21 @@ //////////////////////////////////////////////////////////////////////////////// #import -#import "Spring.h" +#import "Typhoon.h" @interface RXMLElement_SpringXmlComponentFactoryTests : SenTestCase @end @implementation RXMLElement_SpringXmlComponentFactoryTests { - SpringRXMLElement* _element; + TyphoonRXMLElement* _element; } - (void)setUp { - NSString* xmlString = [[SpringBundleResource withName:@"MiddleAgesAssembly.xml"] asString]; + NSString* xmlString = [[TyphoonBundleResource withName:@"MiddleAgesAssembly.xml"] asString]; NSLog(@"Xml string: %@", xmlString); - _element = [SpringRXMLElement elementFromXMLString:xmlString encoding:NSUTF8StringEncoding]; + _element = [TyphoonRXMLElement elementFromXMLString:xmlString encoding:NSUTF8StringEncoding]; } - (void)test_asComponentDefinition @@ -32,11 +32,11 @@ - (void)test_asComponentDefinition NSMutableArray* componentDefinitions = [[NSMutableArray alloc] init]; - [_element iterate:@"*" usingBlock:^(SpringRXMLElement* child) + [_element iterate:@"*" usingBlock:^(TyphoonRXMLElement* child) { if ([[child tag] isEqualToString:@"component"]) { - SpringComponentDefinition* definition = [child asComponentDefinition]; + TyphoonComponentDefinition* definition = [child asComponentDefinition]; NSLog(@"Here's the component definition: %@", definition); [componentDefinitions addObject:definition]; } diff --git a/Tests/Factory/Xml/SpringXmlComponentFactoryTests.m b/Tests/Factory/Xml/TyphoonXmlComponentFactoryTests.m similarity index 75% rename from Tests/Factory/Xml/SpringXmlComponentFactoryTests.m rename to Tests/Factory/Xml/TyphoonXmlComponentFactoryTests.m index b4a3beb1f..12280f4cf 100644 --- a/Tests/Factory/Xml/SpringXmlComponentFactoryTests.m +++ b/Tests/Factory/Xml/TyphoonXmlComponentFactoryTests.m @@ -10,25 +10,25 @@ //////////////////////////////////////////////////////////////////////////////// #import -#import "Spring.h" +#import "Typhoon.h" #import "Knight.h" #import "ClassADependsOnB.h" #import "Sword.h" #import "CavalryMan.h" -@interface SpringXmlComponentFactoryTests : SenTestCase +@interface TyphoonXmlComponentFactoryTests : SenTestCase @end -@implementation SpringXmlComponentFactoryTests +@implementation TyphoonXmlComponentFactoryTests { - SpringComponentFactory* _componentFactory; + TyphoonComponentFactory* _componentFactory; } - (void)setUp { - _componentFactory = [[SpringXmlComponentFactory alloc] initWithConfigFileName:@"MiddleAgesAssembly.xml"]; - SpringPropertyPlaceholderConfigurer* configurer = [[SpringPropertyPlaceholderConfigurer alloc] init]; - [configurer usePropertyStyleResource:[SpringBundleResource withName:@"SomeProperties.properties"]]; + _componentFactory = [[TyphoonXmlComponentFactory alloc] initWithConfigFileName:@"MiddleAgesAssembly.xml"]; + TyphoonPropertyPlaceholderConfigurer* configurer = [[TyphoonPropertyPlaceholderConfigurer alloc] init]; + [configurer usePropertyStyleResource:[TyphoonBundleResource withName:@"SomeProperties.properties"]]; [_componentFactory attachMutator:configurer]; [_componentFactory makeDefault]; } @@ -38,7 +38,7 @@ - (void)setUp - (void)test_property_injection_by_reference { - Knight* knight = [[SpringXmlComponentFactory defaultFactory] componentForKey:@"knight"]; + Knight* knight = [[TyphoonXmlComponentFactory defaultFactory] componentForKey:@"knight"]; assertThat(knight, notNilValue()); assertThat(knight.quest, notNilValue()); @@ -50,7 +50,7 @@ - (void)test_property_injection_by_reference - (void)test_mixed_initializer_and_property_injection { - Knight* anotherKnight = [[SpringXmlComponentFactory defaultFactory] componentForKey:@"anotherKnight"]; + Knight* anotherKnight = [[TyphoonXmlComponentFactory defaultFactory] componentForKey:@"anotherKnight"]; NSLog(@"Here's another knight: %@", anotherKnight); assertThat(anotherKnight.quest, notNilValue()); assertThatBool(anotherKnight.hasHorseWillTravel, equalToBool(YES)); @@ -67,7 +67,7 @@ - (void)test_factory_method_injection - (void)test_factory_method_injection_raises_exception_if_required_class_not_set { - SpringXmlComponentFactory* factory = [[SpringXmlComponentFactory alloc] initWithConfigFileName:@"ExceptionTestAssembly.xml"]; + TyphoonXmlComponentFactory* factory = [[TyphoonXmlComponentFactory alloc] initWithConfigFileName:@"ExceptionTestAssembly.xml"]; @try { NSURL* url = [factory componentForKey:@"anotherServiceUrl"]; @@ -93,7 +93,7 @@ - (void)test_returns_component_from_factory_component - (void)test_prevents_circular_dependencies_by_reference { - SpringXmlComponentFactory* factory = [[SpringXmlComponentFactory alloc] initWithConfigFileName:@"CircularDependenciesAssembly.xml"]; + TyphoonXmlComponentFactory* factory = [[TyphoonXmlComponentFactory alloc] initWithConfigFileName:@"CircularDependenciesAssembly.xml"]; @try { @@ -109,7 +109,7 @@ - (void)test_prevents_circular_dependencies_by_reference - (void)test_prevents_circular_dependencies_by_type { - SpringXmlComponentFactory* factory = [[SpringXmlComponentFactory alloc] initWithConfigFileName:@"CircularDependenciesAssembly.xml"]; + TyphoonXmlComponentFactory* factory = [[TyphoonXmlComponentFactory alloc] initWithConfigFileName:@"CircularDependenciesAssembly.xml"]; @try { @@ -130,7 +130,7 @@ - (void)test_prevents_circular_dependencies_by_type - (void)test_raises_exception_for_invalid_selector_name { - SpringXmlComponentFactory* factory = [[SpringXmlComponentFactory alloc] initWithConfigFileName:@"ExceptionTestAssembly.xml"]; + TyphoonXmlComponentFactory* factory = [[TyphoonXmlComponentFactory alloc] initWithConfigFileName:@"ExceptionTestAssembly.xml"]; @try { @@ -150,9 +150,9 @@ - (void)test_raises_exception_for_invalid_selector_name - (void)test_resolves_property_values { - SpringXmlComponentFactory* factory = [[SpringXmlComponentFactory alloc] initWithConfigFileName:@"PropertyPlaceholderAssembly.xml"]; - SpringPropertyPlaceholderConfigurer* configurer = [SpringPropertyPlaceholderConfigurer configurer]; - [configurer usePropertyStyleResource:[SpringBundleResource withName:@"SomeProperties.properties"]]; + TyphoonXmlComponentFactory* factory = [[TyphoonXmlComponentFactory alloc] initWithConfigFileName:@"PropertyPlaceholderAssembly.xml"]; + TyphoonPropertyPlaceholderConfigurer* configurer = [TyphoonPropertyPlaceholderConfigurer configurer]; + [configurer usePropertyStyleResource:[TyphoonBundleResource withName:@"SomeProperties.properties"]]; [factory attachMutator:configurer]; Knight* knight = [factory componentForKey:@"knight"]; diff --git a/Tests/JuicyTests-Prefix.pch b/Tests/JuicyTests-Prefix.pch index 258752d68..c1dde2bf9 100644 --- a/Tests/JuicyTests-Prefix.pch +++ b/Tests/JuicyTests-Prefix.pch @@ -1,5 +1,5 @@ // -// Prefix header for all source files of the 'SpringComponentDefinitionTests' target in the 'SpringComponentDefinitionTests' project +// Prefix header for all source files of the 'TyphoonComponentDefinitionTests' target in the 'TyphoonComponentDefinitionTests' project // #ifdef __OBJC__ diff --git a/Tests/Model/CavalryMan.h b/Tests/Model/CavalryMan.h index df640f9f4..ef58b96ff 100644 --- a/Tests/Model/CavalryMan.h +++ b/Tests/Model/CavalryMan.h @@ -12,8 +12,8 @@ #import #import "Knight.h" -#import "SpringPropertyInjectionDelegate.h" +#import "TyphoonPropertyInjectionDelegate.h" -@interface CavalryMan : Knight +@interface CavalryMan : Knight @end \ No newline at end of file diff --git a/Tests/Resources/CircularDependenciesAssembly.xml b/Tests/Resources/CircularDependenciesAssembly.xml index 639a5c792..5a7afff2f 100644 --- a/Tests/Resources/CircularDependenciesAssembly.xml +++ b/Tests/Resources/CircularDependenciesAssembly.xml @@ -1,6 +1,6 @@ - diff --git a/Tests/Resources/ExceptionTestAssembly.xml b/Tests/Resources/ExceptionTestAssembly.xml index 3920db8af..809d78bb1 100644 --- a/Tests/Resources/ExceptionTestAssembly.xml +++ b/Tests/Resources/ExceptionTestAssembly.xml @@ -1,7 +1,7 @@ - + xsi:schemaLocation="http://jasperblues.github.com/typhoon/schema/assembly + http://www.appsquick.ly/schema/assembly.xsd"> diff --git a/Tests/Resources/MiddleAgesAssembly.xml b/Tests/Resources/MiddleAgesAssembly.xml index d233af3f3..66f8becfe 100644 --- a/Tests/Resources/MiddleAgesAssembly.xml +++ b/Tests/Resources/MiddleAgesAssembly.xml @@ -1,6 +1,6 @@ - diff --git a/Tests/Resources/PropertyPlaceholderAssembly.xml b/Tests/Resources/PropertyPlaceholderAssembly.xml index 7b2ed486c..360595116 100644 --- a/Tests/Resources/PropertyPlaceholderAssembly.xml +++ b/Tests/Resources/PropertyPlaceholderAssembly.xml @@ -1,6 +1,6 @@ - diff --git a/Tests/TypeConversion/SpringPrimitiveTypeConverterTests.m b/Tests/TypeConversion/TyphoonPrimitiveTypeConverterTests.m similarity index 75% rename from Tests/TypeConversion/SpringPrimitiveTypeConverterTests.m rename to Tests/TypeConversion/TyphoonPrimitiveTypeConverterTests.m index f08cef45c..e24f7668a 100644 --- a/Tests/TypeConversion/SpringPrimitiveTypeConverterTests.m +++ b/Tests/TypeConversion/TyphoonPrimitiveTypeConverterTests.m @@ -10,12 +10,12 @@ //////////////////////////////////////////////////////////////////////////////// #import -#import "SpringPrimitiveTypeConverter.h" -#import "SpringTypeDescriptor.h" -#import "SpringIntrospectiveNSObject.h" -#import "NSObject+SpringIntrospectionUtils.h" +#import "TyphoonPrimitiveTypeConverter.h" +#import "TyphoonTypeDescriptor.h" +#import "TyphoonIntrospectiveNSObject.h" +#import "NSObject+TyphoonIntrospectionUtils.h" -@interface SpringPrimitiveTypeConverterTests : SenTestCase +@interface TyphoonPrimitiveTypeConverterTests : SenTestCase @property(nonatomic) BOOL boolProperty; @property(nonatomic) int intProperty; @@ -24,19 +24,19 @@ @interface SpringPrimitiveTypeConverterTests : SenTestCase @end -@implementation SpringPrimitiveTypeConverterTests +@implementation TyphoonPrimitiveTypeConverterTests { - SpringPrimitiveTypeConverter* _typeConverter; + TyphoonPrimitiveTypeConverter* _typeConverter; } - (void)setUp { - _typeConverter = [[SpringPrimitiveTypeConverter alloc] init]; + _typeConverter = [[TyphoonPrimitiveTypeConverter alloc] init]; } - (void)test_convertToBool { - SpringTypeDescriptor* typeDescriptor = [self typeForPropertyWithName:@"boolProperty"]; + TyphoonTypeDescriptor* typeDescriptor = [self typeForPropertyWithName:@"boolProperty"]; BOOL converted = (BOOL) [_typeConverter convert:@"true" requiredType:typeDescriptor]; assertThatBool(converted, equalToBool(YES)); @@ -59,7 +59,7 @@ - (void)test_convertToBool - (void)test_convertToInt { - SpringTypeDescriptor* typeDescriptor = [self typeForPropertyWithName:@"intProperty"]; + TyphoonTypeDescriptor* typeDescriptor = [self typeForPropertyWithName:@"intProperty"]; int converted = (int) [_typeConverter convert:@"123" requiredType:typeDescriptor]; assertThatInt(converted, equalToInt(123)); @@ -70,7 +70,7 @@ - (void)test_convertToInt - (void)test_convertToNSUInteger { - SpringTypeDescriptor* typeDescriptor = [self typeForPropertyWithName:@"nsuIntegerProperty"]; + TyphoonTypeDescriptor* typeDescriptor = [self typeForPropertyWithName:@"nsuIntegerProperty"]; NSUInteger converted = (NSUInteger) [_typeConverter convert:@"123" requiredType:typeDescriptor]; assertThatUnsignedLongLong(converted, equalToUnsignedLongLong(123)); diff --git a/Tests/TypeConversion/SpringTypeConverterRegistryTests.m b/Tests/TypeConversion/TyphoonTypeConverterRegistryTests.m similarity index 63% rename from Tests/TypeConversion/SpringTypeConverterRegistryTests.m rename to Tests/TypeConversion/TyphoonTypeConverterRegistryTests.m index 8c4b3c4a1..e77b934fd 100644 --- a/Tests/TypeConversion/SpringTypeConverterRegistryTests.m +++ b/Tests/TypeConversion/TyphoonTypeConverterRegistryTests.m @@ -10,36 +10,36 @@ //////////////////////////////////////////////////////////////////////////////// #import -#import "SpringTypeConverterRegistry.h" -#import "SpringTypeDescriptor.h" -#import "NSObject+SpringIntrospectionUtils.h" -#import "SpringTypeConverter.h" -#import "SpringNSURLTypeConverter.h" +#import "TyphoonTypeConverterRegistry.h" +#import "TyphoonTypeDescriptor.h" +#import "NSObject+TyphoonIntrospectionUtils.h" +#import "TyphonTypeConverter.h" +#import "TyphoonNSURLTypeConverter.h" -@interface SpringTypeConverterRegistryTests : SenTestCase +@interface TyphoonTypeConverterRegistryTests : SenTestCase @property(nonatomic, strong) NSData* data; @end -@implementation SpringTypeConverterRegistryTests +@implementation TyphoonTypeConverterRegistryTests { - SpringTypeConverterRegistry* _registry; + TyphoonTypeConverterRegistry* _registry; } - (void)setUp { - _registry = [SpringTypeConverterRegistry shared]; + _registry = [TyphoonTypeConverterRegistry shared]; } - (void)test_raises_exception_when_converter_class_not_registered { - SpringTypeDescriptor* typeDescriptor = [self typeForPropertyWithName:@"data"]; + TyphoonTypeDescriptor* typeDescriptor = [self typeForPropertyWithName:@"data"]; @try { - id converter = [[SpringTypeConverterRegistry shared] converterFor:typeDescriptor]; + id converter = [[TyphoonTypeConverterRegistry shared] converterFor:typeDescriptor]; NSLog(@"here's the converter: %@", converter); STFail(@"Should've thrown exception"); } @@ -53,7 +53,7 @@ - (void)test_raises_exception_when_converter_registered_more_than_once { @try { - SpringNSURLTypeConverter* converter = [[SpringNSURLTypeConverter alloc] init]; + TyphoonNSURLTypeConverter* converter = [[TyphoonNSURLTypeConverter alloc] init]; [_registry register:converter forClassOrProtocol:[NSURL class]]; STFail(@"SHould have thrown exception"); } diff --git a/Tests/Utils/NSObject+SpringReflectionUtilsTests.m b/Tests/Utils/NSObject+TyphoonIntrospectionUtilsTests.m similarity index 70% rename from Tests/Utils/NSObject+SpringReflectionUtilsTests.m rename to Tests/Utils/NSObject+TyphoonIntrospectionUtilsTests.m index 406b9a50f..76eb18951 100644 --- a/Tests/Utils/NSObject+SpringReflectionUtilsTests.m +++ b/Tests/Utils/NSObject+TyphoonIntrospectionUtilsTests.m @@ -10,9 +10,9 @@ //////////////////////////////////////////////////////////////////////////////// #import -#import "SpringTypeDescriptor.h" +#import "TyphoonTypeDescriptor.h" #import "Knight.h" -#import "NSObject+SpringIntrospectionUtils.h" +#import "NSObject+TyphoonIntrospectionUtils.h" typedef struct { @@ -36,46 +36,46 @@ @implementation NSObject_SpringReflectionUtilsTests - (void)test_typeForPropertyWithName_char { - SpringTypeDescriptor* descriptor = [self typeForPropertyWithName:@"charProperty"]; + TyphoonTypeDescriptor* descriptor = [self typeForPropertyWithName:@"charProperty"]; assertThatBool(descriptor.isPrimitive, equalToBool(YES)); - assertThatInt(descriptor.primitiveType, equalToInt(SpringPrimitiveTypeChar)); + assertThatInt(descriptor.primitiveType, equalToInt(TyphoonPrimitiveTypeChar)); } - (void)test_typeForPropertyWithName_int { - SpringTypeDescriptor* descriptor = [self typeForPropertyWithName:@"intProperty"]; + TyphoonTypeDescriptor* descriptor = [self typeForPropertyWithName:@"intProperty"]; assertThatBool(descriptor.isPrimitive, equalToBool(YES)); assertThatBool(descriptor.isPointer, equalToBool(NO)); - assertThatInt(descriptor.primitiveType, equalToInt(SpringPrimitiveTypeInt)); + assertThatInt(descriptor.primitiveType, equalToInt(TyphoonPrimitiveTypeInt)); } - (void)test_typeForPropertyWithName_short { - SpringTypeDescriptor* descriptor = [self typeForPropertyWithName:@"shortProperty"]; + TyphoonTypeDescriptor* descriptor = [self typeForPropertyWithName:@"shortProperty"]; assertThatBool(descriptor.isPrimitive, equalToBool(YES)); assertThatBool(descriptor.isPointer, equalToBool(NO)); - assertThatInt(descriptor.primitiveType, equalToInt(SpringPrimitiveTypeShort)); + assertThatInt(descriptor.primitiveType, equalToInt(TyphoonPrimitiveTypeShort)); } - (void)test_typeForPropertyWithName_long { - SpringTypeDescriptor* descriptor = [self typeForPropertyWithName:@"longProperty"]; + TyphoonTypeDescriptor* descriptor = [self typeForPropertyWithName:@"longProperty"]; assertThatBool(descriptor.isPrimitive, equalToBool(YES)); assertThatBool(descriptor.isPointer, equalToBool(NO)); - assertThatInt(descriptor.primitiveType, equalToInt(SpringPrimitiveTypeLongLong)); + assertThatInt(descriptor.primitiveType, equalToInt(TyphoonPrimitiveTypeLongLong)); } - (void)test_typeForPropertyWithName_pointerToLongLong { - SpringTypeDescriptor* descriptor = [self typeForPropertyWithName:@"pointerToLongLongProperty"]; + TyphoonTypeDescriptor* descriptor = [self typeForPropertyWithName:@"pointerToLongLongProperty"]; assertThatBool(descriptor.isPrimitive, equalToBool(YES)); assertThatBool(descriptor.isPointer, equalToBool(YES)); - assertThatInt(descriptor.primitiveType, equalToInt(SpringPrimitiveTypeUnsignedLongLong)); + assertThatInt(descriptor.primitiveType, equalToInt(TyphoonPrimitiveTypeUnsignedLongLong)); } - (void)test_typeForPropertyWithName_struct { - SpringTypeDescriptor* descriptor = [self typeForPropertyWithName:@"structProperty"]; + TyphoonTypeDescriptor* descriptor = [self typeForPropertyWithName:@"structProperty"]; assertThatBool(descriptor.isPrimitive, equalToBool(YES)); assertThatBool(descriptor.isPointer, equalToBool(NO)); assertThatBool(descriptor.isStructure, equalToBool(YES)); @@ -108,15 +108,15 @@ - (void)test_typeCodesForSelectorWithName assertThat([typeCodes objectAtIndex:0], equalTo(@"@")); assertThat([typeCodes objectAtIndex:1], equalTo(@"Q")); -// SpringTypeDescriptor* typeDescriptor = [SpringTypeDescriptor descriptorWithClassOrProtocol:@protocol(NSObject+SpringIntrospectionUtils)]; +// TyphoonTypeDescriptor* typeDescriptor = [TyphoonTypeDescriptor descriptorWithClassOrProtocol:@protocol(NSObject+TyphoonIntrospectionUtils+TyphoonIntrospectionUtils)]; // assertThatBool(typeDescriptor.isPrimitive, equalToBool(NO)); // assertThat([typeDescriptor classOrProtocol], notNilValue()); // LogDebug(@"The type: %@", NSStringFromProtocol(typeDescriptor.classOrProtocol)); - SpringTypeDescriptor* typeDescriptor = [SpringTypeDescriptor descriptorWithTypeCode:[typeCodes objectAtIndex:1]]; + TyphoonTypeDescriptor* typeDescriptor = [TyphoonTypeDescriptor descriptorWithTypeCode:[typeCodes objectAtIndex:1]]; assertThatBool(typeDescriptor.isPrimitive, equalToBool(YES)); - assertThatInt(typeDescriptor.primitiveType, equalToInt(SpringPrimitiveTypeUnsignedLongLong)); + assertThatInt(typeDescriptor.primitiveType, equalToInt(TyphoonPrimitiveTypeUnsignedLongLong)); } diff --git a/build-configuration.properties b/build-configuration.properties index 532e54cf6..8d6860d5a 100644 --- a/build-configuration.properties +++ b/build-configuration.properties @@ -1,5 +1,5 @@ #----------------------------------------------- Release Configuration ------------------------------------------------# -module.name=Spring-Objective-C +module.name=Typhoon module.company=Jasper_Blues module.sdk.version=6.0 @@ -13,7 +13,7 @@ source.main.dir=${basedir}/Source source.unit.test.dir=${basedir}/Tests #------------------------------------------------------- Targets ------------------------------------------------------# -application.target.name=Spring-Objective-C +application.target.name=Typhoon tests.target.name=Tests xcodebuild=/usr/bin/xcodebuild tools.paths=/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin diff --git a/build.xml b/build.xml index e453870a7..139f71570 100644 --- a/build.xml +++ b/build.xml @@ -102,7 +102,7 @@ #!/bin/sh geninfo "${temp.dir}/coverage-data/"*.gcda --no-recursion -o "${temp.dir}/coverage-temp.info" #Remove symbols we're not interested in. - lcov -r "${temp.dir}/coverage-temp.info" _string.h NSRange.h once.h SpringRXMLElement.m SpringRXMLElement.h > "${temp.dir}/coverage.info" + lcov -r "${temp.dir}/coverage-temp.info" _string.h NSRange.h once.h TyphoonRXMLElement.m TyphoonRXMLElement.h > "${temp.dir}/coverage.info" @@ -184,10 +184,10 @@ - + - + @@ -198,7 +198,7 @@ mkdir -p "${target.dir}/ios-universal/Headers" && # Generate universal binary from desktop, device, and simulator builds. - lipo "${temp.dir}/simulator/libSpring-iOS-StaticLib.a" "${temp.dir}/device/libSpring-iOS-StaticLib.a" -create -output "${target.dir}/ios-universal/libSpring-iOS.a" + lipo "${temp.dir}/simulator/libTyphoon-iOS-StaticLib.a" "${temp.dir}/device/libTyphoon-iOS-StaticLib.a" -create -output "${target.dir}/ios-universal/libTyphoon-iOS.a" @@ -215,11 +215,11 @@ - + - - + + diff --git a/schema/assembly.xsd b/schema/assembly.xsd index 404f3ae37..026b408b5 100644 --- a/schema/assembly.xsd +++ b/schema/assembly.xsd @@ -1,14 +1,14 @@ - + targetNamespace="http://jasperblues.github.com/typhoon/schema/assembly"> @@ -107,7 +107,7 @@ component properties. The method must have no arguments, but may throw any exception. - This is an alternative to implementing Spring Objective-C's SpringPropertyInjectionDelegate + This is an alternative to implementing TyphoonPropertyInjectionDelegate protocol. ]]> @@ -119,7 +119,7 @@ component properties. The method must have no arguments, but may throw any exception. - This is an alternative to implementing Spring Objective-C's SpringPropertyInjectionDelegate + This is an alternative to implementing TyphoonPropertyInjectionDelegate protocol. ]]> @@ -207,7 +207,7 @@