【发布时间】:2013-07-16 12:09:35
【问题描述】:
我试图了解这个注解是如何被@WebMethod 调用的
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
@WebService //<----- is this annotation nested in WebService class
@SOAPBinding(style = Style.RPC)
public interface TimeServer {
@WebMethod String getTimeAsString(); //<-------is this nested in a class too
@WebMethod long getTimeAsElapsed();
}
根据我的导入 javax.jws.WebMethod 和 Java 文档
http://docs.oracle.com/javase/7/docs/api/javax/jws/WebMethod.htmlpublic @interface WebMethod 进行了描述。
@WebMethod 注解是否定义为 WebMethod 类?
WebMethod 类的源代码可以是这样的吗?
Public class WebMethod{
//members
//methods
public @interface WebMethod{ //annotation definition in class, is this possible
}
}
如果不是这样,请用一个简单的例子告诉我它是如何完成的。
【问题讨论】:
-
外部类是干什么用的?
-
是嵌套注解的导入 javax.jws.WebMethod
-
我重复一遍。外部类会完成什么?你还没有回答。
标签: java class interface annotations