mirror of
https://github.com/mbierlee/poodinis.git
synced 2024-11-15 04:04:01 +01:00
Rename instantiatableType -> instanceType
This commit is contained in:
parent
95bd7aece6
commit
d888d0a808
|
@ -187,7 +187,7 @@ synchronized class DependencyContainer {
|
||||||
|
|
||||||
private Registration getRegistration(Registration[] candidates, TypeInfo concreteType) {
|
private Registration getRegistration(Registration[] candidates, TypeInfo concreteType) {
|
||||||
foreach(existingRegistration ; candidates) {
|
foreach(existingRegistration ; candidates) {
|
||||||
if (existingRegistration.instantiatableType == concreteType) {
|
if (existingRegistration.instanceType == concreteType) {
|
||||||
return existingRegistration;
|
return existingRegistration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ public void registerContextComponents(ApplicationContextType : ApplicationContex
|
||||||
static if (hasUDA!(__traits(getMember, context, member), Component)) {
|
static if (hasUDA!(__traits(getMember, context, member), Component)) {
|
||||||
auto factoryMethod = &__traits(getMember, context, member);
|
auto factoryMethod = &__traits(getMember, context, member);
|
||||||
auto registration = container.register!(ReturnType!factoryMethod);
|
auto registration = container.register!(ReturnType!factoryMethod);
|
||||||
registration.instanceFactory = new InstanceFactory(registration.instantiatableType, CreatesSingleton.yes, null, factoryMethod);
|
registration.instanceFactory = new InstanceFactory(registration.instanceType, CreatesSingleton.yes, null, factoryMethod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,22 +29,22 @@ class InstanceCreationException : Exception {
|
||||||
|
|
||||||
class Registration {
|
class Registration {
|
||||||
private TypeInfo _registeredType = null;
|
private TypeInfo _registeredType = null;
|
||||||
private TypeInfo_Class _instantiatableType = null;
|
private TypeInfo_Class _instanceType = null;
|
||||||
private Registration linkedRegistration;
|
private Registration linkedRegistration;
|
||||||
|
|
||||||
public @property registeredType() {
|
public @property registeredType() {
|
||||||
return _registeredType;
|
return _registeredType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @property instantiatableType() {
|
public @property instanceType() {
|
||||||
return _instantiatableType;
|
return _instanceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InstanceFactory instanceFactory = null;
|
public InstanceFactory instanceFactory = null;
|
||||||
|
|
||||||
this(TypeInfo registeredType, TypeInfo_Class instantiatableType) {
|
this(TypeInfo registeredType, TypeInfo_Class instanceType) {
|
||||||
this._registeredType = registeredType;
|
this._registeredType = registeredType;
|
||||||
this._instantiatableType = instantiatableType;
|
this._instanceType = instanceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getInstance(InstantiationContext context = new InstantiationContext()) {
|
public Object getInstance(InstantiationContext context = new InstantiationContext()) {
|
||||||
|
@ -111,7 +111,7 @@ class InstanceFactory {
|
||||||
* Effectively makes the given registration a singleton.
|
* Effectively makes the given registration a singleton.
|
||||||
*/
|
*/
|
||||||
public Registration singleInstance(Registration registration) {
|
public Registration singleInstance(Registration registration) {
|
||||||
registration.instanceFactory = new InstanceFactory(registration.instantiatableType, CreatesSingleton.yes, null);
|
registration.instanceFactory = new InstanceFactory(registration.instanceType, CreatesSingleton.yes, null);
|
||||||
return registration;
|
return registration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ public Registration singleInstance(Registration registration) {
|
||||||
* Scopes registrations to return a new instance every time the given registration is resolved.
|
* Scopes registrations to return a new instance every time the given registration is resolved.
|
||||||
*/
|
*/
|
||||||
public Registration newInstance(Registration registration) {
|
public Registration newInstance(Registration registration) {
|
||||||
registration.instanceFactory = new InstanceFactory(registration.instantiatableType, CreatesSingleton.no, null);
|
registration.instanceFactory = new InstanceFactory(registration.instanceType, CreatesSingleton.no, null);
|
||||||
return registration;
|
return registration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ public Registration newInstance(Registration registration) {
|
||||||
* Scopes registrations to return the given instance every time the given registration is resolved.
|
* Scopes registrations to return the given instance every time the given registration is resolved.
|
||||||
*/
|
*/
|
||||||
public Registration existingInstance(Registration registration, Object instance) {
|
public Registration existingInstance(Registration registration, Object instance) {
|
||||||
registration.instanceFactory = new InstanceFactory(registration.instantiatableType, CreatesSingleton.yes, instance);
|
registration.instanceFactory = new InstanceFactory(registration.instanceType, CreatesSingleton.yes, instance);
|
||||||
return registration;
|
return registration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ public string toConcreteTypeListString(Registration[] registrations) {
|
||||||
if (concreteTypeListString.length > 0) {
|
if (concreteTypeListString.length > 0) {
|
||||||
concreteTypeListString ~= ", ";
|
concreteTypeListString ~= ", ";
|
||||||
}
|
}
|
||||||
concreteTypeListString ~= registration.instantiatableType.toString();
|
concreteTypeListString ~= registration.instanceType.toString();
|
||||||
}
|
}
|
||||||
return concreteTypeListString;
|
return concreteTypeListString;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue