Voiteh / Depin

Dependency injection library for Ceylon
Apache License 2.0
0 stars 0 forks source link

Introduce scoping in more generic way #27

Closed Voiteh closed 5 years ago

Voiteh commented 5 years ago

Currently dependency defines for what scope it is created. We have singleton and prototype. It seems that there may be different like request. We need to allow creating custom scopes with annotations. The dependency must be able to be released by calling some custom methods.

Requirements:

Voiteh commented 5 years ago

First the model need to change so we don't have depenency on Dependency.Provider in Dependency.Decorator and related Observer.

abstract class Dependency(shared Definition definition, shared {Dependencies*} dependencies){

  shared formal Anything resolve;
}

The resolve attribute will be provided via

interface Dependency.Resolution{

  shared formal Anything invoke; 

}

Dependency.Factory will create those related objects and i'ts dependencies. Depedency.Provider will be removed anf factory will have direct depedency on Registry/Graph