Remove deprecated muck

This commit is contained in:
Mike Bierlee 2016-08-08 21:32:27 +02:00
parent 8c27738b51
commit 02dbe20c64
4 changed files with 6 additions and 107 deletions

View file

@ -1,5 +1,10 @@
Poodinis Changelog
==================
**Version 7.0.0**
* REMOVE deprecated registration options. They are still available in properly cased forms.
* REMOVE deprecated register() and resolve() methods which accept variadics and arrays for options.
Since registration and resolve options have become bitfields, you should specify them with logical ANDs.
**Version 6.3.0**
* CHANGE registration and resolve options to be supplied using bit flags instead. (Thanks to tmccombs)
* DEPRECATE all other forms of supplying registration and resolve options (by array or variadics)

View file

@ -1,6 +1,6 @@
Poodinis Dependency Injection Framework
=======================================
Version 6.3.0
Version 7.0.0
Copyright 2014-2016 Mike Bierlee
Licensed under the terms of the MIT license - See [LICENSE.txt](LICENSE.txt)

View file

@ -53,13 +53,6 @@ public enum RegistrationOption {
* to use the supertype as the type of the dependency.
*/
doNotAddConcreteTypeRegistration = 1 << 0,
/**
* Prevent a concrete type being registered on itself. With this option you will always need
* to use the supertype as the type of the dependency.
* @deprecated use doNotAddConcreteTypeRegistration instead
*/
DO_NOT_ADD_CONCRETE_TYPE_REGISTRATION = doNotAddConcreteTypeRegistration
}
/**
@ -123,25 +116,6 @@ synchronized class DependencyContainer {
return register!(ConcreteType, ConcreteType)(options);
}
/**
* Deprecated: Use register(ConcreteType)(RegistrationOptions) instead.
*/
deprecated public Registration register(ConcreteType)(RegistrationOption[] options) {
return register!(ConcreteType)(buildFlags(options));
}
/**
* Deprecated: Use register(SuperType, ConcreteType)(RegistrationOptions) instead
*/
deprecated public Registration register(SuperType, ConcreteType : SuperType)(RegistrationOption first, RegistrationOption[] options...) {
return register!(SuperType, ConcreteType)(first | buildFlags(options));
}
/// ditto
deprecated public Registration register(SuperType, ConcreteType : SuperType)(RegistrationOption[] options) {
return register!(SuperType, ConcreteType)(buildFlags(options));
}
/**
* Register a dependency by super type.
*
@ -260,20 +234,6 @@ synchronized class DependencyContainer {
return resolve!(RegistrationType, RegistrationType)(resolveOptions);
}
/**
* Deprecated: Use register(RegistrationType)(ResolveOption) instead.
*/
deprecated public RegistrationType resolve(RegistrationType)(ResolveOption[] resolveOptions) {
return resolve!(RegistrationType)(buildFlags(resolveOptions));
}
/**
* Deprecated: Use register(RegistrationType, QualifierType)(ResolveOption) instead.
*/
deprecated public QualifierType resolve(RegistrationType, QualifierType : RegistrationType)(ResolveOption[] resolveOptions) {
return resolve!(RegistrationType, QualifierType)(buildFlags(resolveOptions));
}
/**
* Resolve dependencies using a qualifier.
*
@ -378,13 +338,6 @@ synchronized class DependencyContainer {
return instances;
}
/**
* Deprecated: Use resolveAll(RegistrationType)(ResolveOptions) instead.
*/
deprecated public RegistrationType[] resolveAll(RegistrationType)(ResolveOption[] resolveOptions) {
return resolveAll!RegistrationType(buildFlags(resolveOptions));
}
private Registration getQualifiedRegistration(TypeInfo resolveType, TypeInfo qualifierType, Registration[] candidates) {
if (resolveType == qualifierType) {
if (candidates.length > 1) {
@ -445,15 +398,6 @@ synchronized class DependencyContainer {
return instance;
}
/**
* Apply persistent registration options which will be used everytime register() is called.
*
* Deprecated: use setPersistentRegistrationOptions(RegistrationOption options) instead.
*/
deprecated public void setPersistentRegistrationOptions(RegistrationOption[] registrationOptions...) {
persistentRegistrationOptions = buildFlags(registrationOptions);
}
/**
* Apply persistent registration options which will be used everytime register() is called.
*/
@ -468,14 +412,6 @@ synchronized class DependencyContainer {
persistentRegistrationOptions = RegistrationOption.none;
}
/**
* Apply persistent resolve options which will be used everytime resolve() is called.
* Deprecated: use setPersistentResolveOptions(ResolveOption options) instead.
*/
deprecated public void setPersistentResolveOptions(ResolveOption[] resolveOptions...) {
persistentResolveOptions = buildFlags(resolveOptions);
}
/**
* Apply persistent resolve options which will be used everytime resolve() is called.
*/

View file

@ -503,24 +503,6 @@ version(unittest) {
assertThrown!ResolveException(container.resolve!TestClass);
}
// Test registering type with option doNotAddConcreteTypeRegistration as array (DEPRECATED)
unittest {
shared(DependencyContainer) container = new DependencyContainer();
container.register!(TestInterface, TestClass)([RegistrationOption.doNotAddConcreteTypeRegistration]);
auto firstInstance = container.resolve!TestInterface;
assertThrown!ResolveException(container.resolve!TestClass);
}
// Test registering type with option DO_NOT_ADD_CONCRETE_TYPE_REGISTRATION (DEPRECATED)
unittest {
shared(DependencyContainer) container = new DependencyContainer();
container.register!(TestInterface, TestClass)(RegistrationOption.DO_NOT_ADD_CONCRETE_TYPE_REGISTRATION);
auto firstInstance = container.resolve!TestInterface;
assertThrown!ResolveException(container.resolve!TestClass);
}
// Test registering conrete type with registration option doNotAddConcreteTypeRegistration does nothing
unittest {
shared(DependencyContainer) container = new DependencyContainer();
@ -528,15 +510,6 @@ version(unittest) {
container.resolve!TestClass;
}
// Test registering type with option doNotAddConcreteTypeRegistration as variadic (DEPRECATED)
unittest {
shared(DependencyContainer) container = new DependencyContainer();
container.register!(TestInterface, TestClass)(RegistrationOption.none, RegistrationOption.doNotAddConcreteTypeRegistration);
auto firstInstance = container.resolve!TestInterface;
assertThrown!ResolveException(container.resolve!TestClass);
}
// Test registering type will register by contrete type by default
unittest {
shared(DependencyContainer) container = new DependencyContainer();
@ -628,14 +601,6 @@ version(unittest) {
assertThrown!ResolveException(container.resolve!TestClass);
}
// Test set persistent registration options by variadic (DEPRECATED)
unittest {
shared(DependencyContainer) container = new DependencyContainer();
container.setPersistentRegistrationOptions(RegistrationOption.none, RegistrationOption.doNotAddConcreteTypeRegistration);
container.register!(TestInterface, TestClass);
assertThrown!ResolveException(container.resolve!TestClass);
}
// Test unset persistent registration options
unittest {
shared(DependencyContainer) container = new DependencyContainer();
@ -659,13 +624,6 @@ version(unittest) {
container.resolve!TestClass;
}
// Test set persistent resolve options by variadic (DEPRECATED)
unittest {
shared(DependencyContainer) container = new DependencyContainer();
container.setPersistentResolveOptions(ResolveOption.none, ResolveOption.registerBeforeResolving);
container.resolve!TestClass;
}
// Test unset persistent resolve options
unittest {
shared(DependencyContainer) container = new DependencyContainer();