我可以在远程/本地接口中使用继承吗? (EJB3) [英] Can I use inheritance in remote/local interfaces? (EJB3)

查看:80
本文介绍了我可以在远程/本地接口中使用继承吗? (EJB3)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个例子:

@Remote
public interface SomeComponentRemote{

    public Something processStuff();

}

//--

@Local
public interface SomeComponentLocal extends SomeComponentRemote{

}

可以吗?我可以定期这样做吗?

Is that allowed? Can i do this regularly?

推荐答案

不允许使用您的方式,因为您不能根据规范同时使用@Local和@Remote批注来标记您的界面.从代码读取的角度来看,这不是一个好主意.

Your way is not allowed as you can not mark your interface with both @Local and @Remote annotations according to specification. And it is not a good idea from point of code reading.

推荐的解决方案是

public interface SomeComponent {
    public Something processStuff();
}

@Local
public interface SomeComponentLocal extends SomeComponent {
}

@Remote
public interface SomeComponentRemote extends SomeComponent {
}

这篇关于我可以在远程/本地接口中使用继承吗? (EJB3)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆