Commit graph

198 commits

Author SHA1 Message Date
Mike Bierlee 95e30477c6 Prevent creation of circular dependencies in constructors 2016-09-03 16:57:38 +02:00
Mike Bierlee ab765e0092 Add constructor injection 2016-08-23 00:11:29 +02:00
Mike Bierlee 81c6faed16 Pass factory through constructor to prevent nullpointer exceptions 2016-08-17 23:01:22 +02:00
Mike Bierlee 941c5b1961 Fix accidentally setting same property 2016-08-17 23:00:21 +02:00
Mike Bierlee 831e38cb56 Let container create instance factory instead of scopes 2016-08-17 22:37:02 +02:00
Mike Bierlee 6b3b23a376 Move factory parameters to parameter object 2016-08-17 22:28:47 +02:00
Mike Bierlee 44e77aff9c Move factory stuff to own module 2016-08-17 20:44:36 +02:00
Mike Bierlee b6ccc9d4a9 Pull keeping track of originating containmer up to Registration class 2016-08-08 23:06:05 +02:00
Mike Bierlee 2a4004856f Deprecate global autowiring function 2016-08-08 22:22:13 +02:00
Mike Bierlee 9e5a27d046 Deprecate singleton factory method
The factory method encourages misuse of dependency injection (by using it as a service locator). Removing the factory method forces the user to make this choice deliberately.
2016-08-08 22:17:17 +02:00
Mike Bierlee 02dbe20c64 Remove deprecated muck 2016-08-08 21:32:27 +02:00
Mike Bierlee 771c49d86a Deprecate array-based assignment of persistent resolve/registration options 2016-06-27 20:55:07 +02:00
Mike Bierlee 2278378080 Shift bit of sole option to indicate it's a bitnum 2016-06-27 20:38:17 +02:00
Thayne McCombs 4e27adc96b Transpose static if to avoid generating dead code. 2016-06-26 21:45:48 -06:00
Thayne McCombs 6255292069 Use bit flags for options.
A more idiomatic and efficient way of passing options.
2016-06-26 21:45:48 -06:00
Mike Bierlee 7308702dfe Add ability to mark autowire dependencies as optional 2016-02-15 22:52:48 +01:00
Mike Bierlee 6746fd64a0 Add resolve options to resolveAll 2016-02-15 22:52:48 +01:00
Mike Bierlee 21d727c500 Add resolve option for not throwing a resolveException 2016-02-15 22:52:47 +01:00
Mike Bierlee 851eeade45 Use more meaningful names for member tuple index variables 2016-02-15 00:26:04 +01:00
Mike Bierlee b7eee5e51f Fix typos of enum RegistrationOption
Fixes #9
2016-02-11 20:40:16 +01:00
Stephan Dilly f84b025110 fix autowiring in base classes 2016-02-09 22:21:36 +01:00
Mike Bierlee 965dcfb0a2 Fix registration of application contexts with non-public members 2016-02-09 21:02:56 +01:00
Mike Bierlee d87c8a0457 Merge branch 'feature/autowire-private-fields' of https://github.com/Extrawurst/poodinis into Extrawurst-feature/autowire-private-fields
Conflicts:
	README.md
2016-02-09 20:28:07 +01:00
Stephan Dilly 7d2ba1bef9 allow autowiring private fields too 2016-02-09 18:01:21 +01:00
Mike Bierlee 5d9ac73418 Add setting persistent resolve options 2016-02-03 23:13:36 +01:00
Mike Bierlee 9ebbb5d917 Add ability to register a type while resolving it
Closes #5
2016-02-03 23:05:39 +01:00
Mike Bierlee 7775dd3c3a Fix not handling variadic as array 2016-02-03 22:37:30 +01:00
Mike Bierlee e7a29f17f7 Allow register by concrete type to also get registration options
Although the currently only available option will do nothing
2016-02-03 22:24:22 +01:00
Mike Bierlee 065e7111cd Deprecate calling register() with RegistationOptions in a variadic way
Variadic options will conflict when added to resolve(). To keep the interface consistent, register should follow suit. Supply options using a list of options instead.
2016-02-03 22:17:10 +01:00
Mike Bierlee 46dddbfd46 Deprecate RegistrationOption.DO_NOT_ADD_CONCRETE_TYPE_REGISTRATION in favor of RegistrationOption.doNotAddConcreteTypeRegistration 2016-02-03 22:15:07 +01:00
Mike Bierlee def5ec2e88 Add setting persistent registration options 2016-02-03 21:28:33 +01:00
Mike Bierlee 7bd0795b3f Fix line delimiters 2016-01-06 20:28:25 +01:00
Mike Bierlee c35e494dfe Update copyrights 2016-01-06 20:18:35 +01:00
Mike Bierlee e2d86bae0d Remove deprecated RegistrationOptions alias 2015-12-28 22:43:53 +01:00
Mike Bierlee 4b1bc5077a Remove deprecated registration option 2015-12-28 22:42:23 +01:00
Mike Bierlee 4d62f3fdb0 Add registering component factories as prototype
Which makes them the opposite of singletons
2015-12-24 21:50:12 +01:00
Mike Bierlee d310640717 Register application contexts as a resolvable dependency
For those who like to play with fire
2015-12-24 20:41:05 +01:00
Mike Bierlee f206b594c8 Add autowiring of application contexts on registration 2015-12-24 20:31:26 +01:00
Mike Bierlee 2e4c688ab2 Add registeration of context components when registering via dependency container 2015-12-24 20:12:48 +01:00
Mike Bierlee 57b548aeae Add specifying components by supertype 2015-12-24 19:51:49 +01:00
Mike Bierlee d888d0a808 Rename instantiatableType -> instanceType 2015-12-24 18:58:34 +01:00
Mike Bierlee 1bf1734c53 Add registration of components through factory methods
A basic version of Bean factories from the Spring framework
2015-12-24 18:45:18 +01:00
Mike Bierlee 55d3139f5b Add registration of basic dependencies through application context 2015-12-24 01:11:39 +01:00
Mike Bierlee be5eb37617 Remove public imports 2015-12-24 01:01:30 +01:00
Mike Bierlee 80916c47fb Add factory method invocation to instance factory 2015-12-23 18:32:29 +01:00
Mike Bierlee 2ebef4c466 Refactor registration scopes into simplified instance factory 2015-12-23 17:51:55 +01:00
Mike Bierlee ae9e0bab68 Rename RegistrationOptions -> RegistrationOption, deprecate usage of old name 2015-09-26 22:46:47 +02:00
Mike Bierlee da16513a8d Always register concrete type when registering type by supertype by default.
This deprecates ADD_CONCRETE_TYPE_REGISTRATION (see DO_NOT_ADD_CONCRETE_TYPE_REGISTRATION for reverse configuration). This also means you do not need to use qualifiers when registering single type of super type by super type.
2015-08-17 22:28:26 +02:00
Mike Bierlee 8c103df7e5 Remove deprecated module "dependency" 2015-08-16 15:50:54 +02:00
Mike Bierlee 3e11ff1e92 Add ability to assign new instance to autowired member regardless of registration scope 2015-07-06 22:55:40 +02:00
Mike Bierlee 533207226b Use template to get member type instead 2015-07-04 14:09:05 +02:00
Mike Bierlee 1ce37e6eda Add autowiring of dynamic arrays 2015-07-04 14:06:35 +02:00
Mike Bierlee 53fb0d8116 Add resolving all registered types of a certain super type 2015-07-04 13:53:47 +02:00
Mike Bierlee 71ac539f2a Add canonical package module
This commit deprecates non-canonical package module "dependency.d".
2015-07-01 21:06:55 +02:00
Mike Bierlee 27e7b74e73 Add registration option for registering a class by concrete type when registering by supertype 2015-05-03 02:03:34 +02:00
Mike Bierlee d23230faae Restrict access to registration members more tightly 2015-05-03 00:54:31 +02:00
Mike Bierlee eb05f7702f Add registration linking 2015-05-03 00:46:51 +02:00
Mike Bierlee a046e1fd8e Remove unused imports 2015-03-28 18:43:03 +01:00
Mike Bierlee ee88b68a7c Remove unnecessary initOnce
The class is synchronized now. Calls to getInstance is already barricaded by the class-level monitor.
2015-03-28 17:49:30 +01:00
Mike Bierlee 9860624148 Synchronize DependencyContainer
The implication is that dependency containers are now always shared data. In the sense of application context, this is acceptable.
2015-03-28 16:36:02 +01:00
Mike Bierlee 8d268846ed Change getting of singleton dependency container to be thread-safe 2015-03-28 15:04:34 +01:00
Mike Bierlee a5f6a1dc32 Finish refactoring for now
It's still not perfect, but traits are real difficult to work with.
2015-03-21 14:30:04 +01:00
Mike Bierlee 29ebb3bc73 Add project identifier to module documentation 2015-03-07 12:36:59 +01:00
Mike Bierlee 06dfb0dc30 Fix imports for release builds 2015-03-07 00:47:36 +01:00
Mike Bierlee 0916e136aa Omit parentheses 2015-02-28 17:16:35 +01:00
Mike Bierlee 264f492292 Get rid of obsolete member reference 2015-02-28 16:59:50 +01:00
Mike Bierlee 3f36b63965 Get member from instance instead 2015-02-28 16:26:57 +01:00
Mike Bierlee 3d6ab10b6d Extracting debug info printing to separate functions 2015-02-28 16:09:32 +01:00
Mike Bierlee 58073dd160 Extract autowiring a member from autowire 2015-02-28 15:51:57 +01:00
Mike Bierlee 89d82efb11 Refactor getting existing registration to separate function 2015-02-22 19:11:38 +01:00
Mike Bierlee f9c2e257c7 Document public API of module "registration" 2015-02-21 16:11:43 +01:00
Mike Bierlee 8ee25abc58 Document public API of module "dependency" 2015-02-21 16:02:33 +01:00
Mike Bierlee a9bbb24fcd Use elipses to pretend there's implementation 2015-02-21 02:38:09 +01:00
Mike Bierlee e3009929a5 Remove deprecated @Autowired alias 2015-02-21 02:33:19 +01:00
Mike Bierlee ad5695c774 Rename parameter InterfaceType -> SuperType
Direct ancestor types, which are not neccesarily interfaces, can also be used as registration type
2015-02-21 02:16:24 +01:00
Mike Bierlee 6c8e3c81b3 Remove unused exception 2015-02-21 02:14:25 +01:00
Mike Bierlee 7945cc0ea3 Document public API of module "container" 2015-02-21 02:12:27 +01:00
Mike Bierlee f6a809c54a Improve autowire module documentation 2015-02-21 01:18:07 +01:00
Mike Bierlee 50e754f429 Deprecate @Autowired UDA in favor of using @Autowire
Keeps your codebase consistent. Also this is not Spring.
2015-02-21 01:10:19 +01:00
Mike Bierlee 0d56a4e5c3 Add additional motivation to documentation. 2015-02-15 17:13:59 +01:00
Mike Bierlee 4c51fcada1 Document public API of module "autowire" 2015-02-15 16:52:10 +01:00
Mike Bierlee 586c03bd91 Remove deprecated dependency container alias 2015-02-15 14:52:50 +01:00
Mike Bierlee e44cdf276a Remove deprecated "autowire in constructor" 2015-02-15 14:52:01 +01:00
Mike Bierlee cb42ebc8c1 Update copyrights 2015-01-25 21:55:02 +01:00
Mike Bierlee 36992c633a Autowire dependencies using autowired registrations instead of letting the container handle it
This fixes known issue "Resolving a class registered by supertype..."
2015-01-25 21:04:17 +01:00
Mike Bierlee 5ebb5805cf Use instantiation context to decide whether to autowire or not 2015-01-25 19:46:17 +01:00
Mike Bierlee 9d931f511b Add registration class that will autowire instances itself 2015-01-25 15:07:11 +01:00
Mike Bierlee 82ea4369b8 Add master module "dependency" 2015-01-25 13:40:11 +01:00
Mike Bierlee 1d74064c15 Reintroduce module container 2015-01-25 13:37:14 +01:00
Mike Bierlee 99579060d3 Return resolved instances by qualifier type instead 2014-12-30 18:29:32 +01:00
Mike Bierlee 7a628c32c4 Add debug specifier to reduce verbosity of debug output 2014-12-24 00:05:42 +01:00
Mike Bierlee 77cc636e7f Deprecate buggy work-around in favor of qualifiers 2014-12-14 19:25:08 +01:00
Mike Bierlee 2aef9a1760 Autowire using the qualifier type when resolving dependencies
This will make sure the members of sub-types are also autowired, when a qualifier is given.
2014-12-14 19:20:35 +01:00
Mike Bierlee 7bc0382a50 Remove left-over debugging output 2014-12-13 23:16:27 +01:00
Mike Bierlee 7ee67ee836 Specify qualifiers in Autowire UDA instead of using separate UDA 2014-12-13 23:15:43 +01:00
Mike Bierlee 1166d2811a Add @Qualifier UDA for qualifying members typed by supertype 2014-12-13 22:06:11 +01:00
Mike Bierlee 9c749c0cb6 Check type at compile-time 2014-12-11 01:40:40 +01:00
Mike Bierlee bc972d1371 Reqord and fix message of multiple qualifier resolve exception 2014-11-27 00:46:03 +01:00
Mike Bierlee 8b9c8d2774 Add ability to resolve type which has multiple registrations by qualifier 2014-11-27 00:33:13 +01:00
Mike Bierlee d6e3043c7d Prevent multiple registrations of same super- and concrete type 2014-11-26 23:37:29 +01:00