[Seasar-user:795] Re: component のinterfaceが継承関係をもつとき

Yasuo Higa higa
2005年 4月 6日 (水) 01:08:16 JST


<20040607024708.003B.TAEDIUM @ zf7.so-net.ne.jp> の、
   "[Seasar-user:794] componentのinterfaceが継承関係をもつとき" において、
   "nakamura toshihiro <taedium @ zf7.so-net.ne.jp>"さんは書きました:

ひがです。

> 中村です。
> 
> componentのinterfaceがextendsをしているときですが、
> S2Container#getComponent(親のinterfaceのClass)とした場合
> ComponentNotFoundRuntimeExceptionが発生します。
> (ちょっと説明しにくいのですがcodeをみてもらえれば単純な話です)
> 
> これはサポートされていてもいいのではと思ったのですが
> どうでしょうか?
> 
次のリリースで対応します。

> 以下、Exceptionが発生する場合のdiconの設定と継承関係です。
> ----------------------------------------------------
> 
> <components>
>     <component name="hoge" class="test.HogeImpl"/>
> </components>
> 
> 
> public interface Foo {
> }
> 
> 
> public interface Hoge extends Foo {
> }
> 
> 
> public class HogeImpl implements Hoge {
> }
> 
> 
> public class HogeClient {
>     private static final String PATH ="test/hoge.dicon";        
>     public static void main(String[] args) {
>         S2Container container = S2ContainerFactory.create(PATH);
>         Foo foo = (Foo)container.getComponent(Foo.class);
>     }
> }
> 
> --
> Nakamura Toshihiro
> 
> 
> 
> _______________________________________________
> Seasar-user mailing list
> Seasar-user @ lists.sourceforge.jp
> http://lists.sourceforge.jp/mailman/listinfo/seasar-user
> 



Seasar-user メーリングリストの案内