@ServiceMethod(serviceId = "serviceAddServiceUserByNameAnnotation") @ServiceResult(name = "user2") public ServiceUser addServiceUser(@ServiceParameter(name = "name") String name) { String info = String.format("添加了一名新用户%s(名称添加)", name); logger.logMessage(LogLevel.INFO, "", info); ServiceUser user2 = new ServiceUser(); user2.setName(name); return user2; }
@ServiceMethod() @ServiceResult() public ServiceUser addServiceUserNoResultName(@ServiceParameter(name = "name") String name) { String info = String.format("添加了一名新用户%s(名称添加)", name); logger.logMessage(LogLevel.INFO, "", info); ServiceUser user2 = new ServiceUser(); user2.setName(name); return user2; }
@ServiceMethod(serviceId = "serviceAddServiceUserAnnotation") @ServiceResult(name = "user2") public ServiceUser addServiceUser( @ServiceParameter(name = "user", required = false) ServiceUser user) { ServiceUser user2 = user; if (user2 == null) { user2 = new ServiceUser(); user2.setName("user2"); String info1 = String.format("参数未传递,自行创建新用户%s", user2.getName()); String info2 = String.format("添加了一名新用户%s(对象添加)", user2.getName()); logger.logMessage(LogLevel.INFO, info1); logger.logMessage(LogLevel.INFO, info2); } else { String info = String.format("添加了一名新用户%s(对象添加)", user2.getName()); logger.logMessage(LogLevel.INFO, info); } return user2; }