-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added IDependencyResolver, static class DependencyResolver for settin…
…g current resolver, a default implementation (DefaultDependencyResolver) and implemented everything into the framework for controllers and filters.
- Loading branch information
Andreas
committed
Jan 11, 2011
1 parent
f8e0792
commit c5f246c
Showing
14 changed files
with
89 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package ufront.web.mvc; | ||
import thx.error.Error; | ||
|
||
/** | ||
* ... | ||
* @author Andreas Soderlund | ||
*/ | ||
|
||
class DefaultDependencyResolver implements IDependencyResolver | ||
{ | ||
public function new(); | ||
|
||
public function getService<T>(type : Class<T>) : T | ||
{ | ||
try | ||
{ | ||
return Type.createInstance(type, []); | ||
} | ||
catch(e : Dynamic) | ||
{ | ||
return null; | ||
} | ||
} | ||
|
||
public function getServices<T>(serviceType : Class<T>) : Iterable<T> | ||
{ | ||
return new List<T>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package ufront.web.mvc; | ||
import thx.error.Error; | ||
|
||
/** | ||
* ... | ||
* @author Andreas Soderlund | ||
*/ | ||
|
||
class DependencyResolver | ||
{ | ||
public static var current : IDependencyResolver = new DefaultDependencyResolver(); | ||
|
||
public static function setResolver(resolver : IDependencyResolver) | ||
{ | ||
DependencyResolver.current = resolver; | ||
return resolver; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package ufront.web.mvc; | ||
|
||
/** | ||
* ... | ||
* @author Andreas Soderlund | ||
*/ | ||
|
||
interface IDependencyResolver | ||
{ | ||
function getService<T>(serviceType : Class<T>) : T; | ||
function getServices<T>(serviceType : Class<T>) : Iterable<T>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters