Rename instantiatableType -> instanceType

This commit is contained in:
Mike Bierlee 2015-12-24 18:58:34 +01:00
parent 95bd7aece6
commit d888d0a808
3 changed files with 11 additions and 11 deletions

View file

@ -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;
} }
} }

View file

@ -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);
} }
} }
} }

View file

@ -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;
} }