Check if a Type is registered

This commit is contained in:
heromyth 2020-03-11 09:55:15 +08:00
parent 3d87339da6
commit 0c8c1434f7

View file

@ -373,6 +373,12 @@ synchronized class DependencyContainer {
} }
} }
bool isRegistered(RegistrationType)() {
TypeInfo typeInfo = typeid(RegistrationType);
auto candidates = typeInfo in registrations;
return candidates !is null;
}
private QualifierType resolveAutowiredInstance(QualifierType)(Registration registration) { private QualifierType resolveAutowiredInstance(QualifierType)(Registration registration) {
QualifierType instance; QualifierType instance;
if (!(cast(Registration[]) autowireStack).canFind(registration)) { if (!(cast(Registration[]) autowireStack).canFind(registration)) {