mirror of
https://github.com/mbierlee/poodinis.git
synced 2024-11-15 04:04:01 +01:00
Restrict access to registration members more tightly
This commit is contained in:
parent
eb05f7702f
commit
d23230faae
|
@ -19,14 +19,23 @@ debug {
|
|||
}
|
||||
|
||||
class Registration {
|
||||
TypeInfo registeredType = null;
|
||||
TypeInfo_Class instantiatableType = null;
|
||||
CreationScope registationScope = null;
|
||||
private TypeInfo _registeredType = null;
|
||||
private TypeInfo_Class _instantiatableType = null;
|
||||
private Registration linkedRegistration;
|
||||
|
||||
public @property registeredType() {
|
||||
return _registeredType;
|
||||
}
|
||||
|
||||
public @property instantiatableType() {
|
||||
return _instantiatableType;
|
||||
}
|
||||
|
||||
public CreationScope registationScope = null;
|
||||
|
||||
this(TypeInfo registeredType, TypeInfo_Class instantiatableType) {
|
||||
this.registeredType = registeredType;
|
||||
this.instantiatableType = instantiatableType;
|
||||
this._registeredType = registeredType;
|
||||
this._instantiatableType = instantiatableType;
|
||||
}
|
||||
|
||||
public Object getInstance(InstantiationContext context = new InstantiationContext()) {
|
||||
|
|
|
@ -18,8 +18,7 @@ version(unittest) {
|
|||
|
||||
// Test getting instance without scope defined throws exception
|
||||
unittest {
|
||||
Registration registration = new Registration(null, null);
|
||||
registration.registeredType = typeid(TestType);
|
||||
Registration registration = new Registration(typeid(TestType), null);
|
||||
assertThrown!(NoScopeDefinedException)(registration.getInstance());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue