我的简单问题。
情况:需要编写类似ID
的端点
仅静态TYPE
和@Path("{" + ID + "}/{" + TYPE "}")
public void doSth(@PathParam(ID) String Id, @PathParam(TYPE) String type) {}
PATH_XXX
静态static final String PATH_ID = "{" + ID + "}";
static final String PATH_TYPE = "{" + TYPE + "}";
@Path(PATH_ID + SLASH + PATH_TYPE)
public void doSth(@PathParam(ID) String Id, @PathParam(TYPE) String type) {}
func chooseStepFunction(backward: Bool) -> (Int) -> Int {
func stepForward(input: Int) -> Int { return input + 1 }
func stepBackward(input: Int) -> Int { return input - 1 }
return backward ? stepBackward : stepForward
}
你们怎么看,哪个更好用?
答案 0 :(得分:1)
我愿意
@Path("{id}/{type}")
public void doSth(@PathParam("id") String id, @PathParam("type") String type) {}