私はデスクトップGISアプリケーションを作成しており、MapXtreme、MS Virtual Earthおよびカスタムマップエンジンをサポートしています。アプリケーションの実行時に、このようなマップエンジンを変更するFactoryクラスがあります。依存関係注入を使用して実行時に作成する実装を決定する
public class MapFactory implements IMapFactory
{
public IMapEngine createInstance(MapType type)
{
if(type==MapType.MapXtreme)
return new MapXtremeEngine();
else if(type==MapType.VirtualEarth)
return new VirtualEarth();
//....other code
}
}
実行時に型パラメータによって適切なMapEngine実装を作成するためにDependency Injection Frameworkを使用できますか?
提案はありますか? – mcaaltuntas