是否可以更多地实现带注释的休息接口?

时间:2017-02-04 17:46:32

标签: rest java-ee-7

是否可以更多地实现带注释的REST接口,以便应用程序。服务器决定使用哪种实现,例如关于它的@Priority?

示例:

@Path("endpoint")
public interface Endpoint {
    @GET("{id}")
    RetVal get(Integer id);
}

@Priority(100)
public class EndpointImpl implements Endpoint {
    RetVal get(Integer id) {
        return new RetVal();
    }
}

@Priority(200)
public class ExtendedEndpointImpl implements Endpoint {
    ExtendedRetVal get(Integer id) {
        return new ExtendedRetVal(); // class ExtendedRetVal extends RetVal
    }
}

0 个答案:

没有答案
相关问题