首页 \ 问答 \ 将@PathParam和@QueryParam重新映射到Pojo(Resteasy mapping @PathParam and @QueryParam to Pojo)

将@PathParam和@QueryParam重新映射到Pojo(Resteasy mapping @PathParam and @QueryParam to Pojo)

我想在一个宁静的ws中减少我的代码行。 我的服务是:

@GET
    @Path("/acc_bloq/{unit}/{id}/search")
    @Produces("application/json")
    public FiltroBean getAcc_Bloq(@PathParam("unit") String unit,
           @PathParam("id") int id, @QueryParam("init") int init, @QueryParam("end") int end){}

有没有办法直接将参数映射到POJO? 所以要保存代码行

Filter filter = new Filter()
filter.set....
filter.set...

提前致谢。


I want to reduce my lines of code in a restful ws. My service is :

@GET
    @Path("/acc_bloq/{unit}/{id}/search")
    @Produces("application/json")
    public FiltroBean getAcc_Bloq(@PathParam("unit") String unit,
           @PathParam("id") int id, @QueryParam("init") int init, @QueryParam("end") int end){}

Is there any way to mapping directly the parameters to a POJO? so to save lines of code

Filter filter = new Filter()
filter.set....
filter.set...

Thanks in advance.


原文:
更新时间:2022-07-13 12:07

最满意答案

没有必要通过警报调用dismiss它会在你按下AlertController任何动作时自动解除警报。

因此,只需在您的操作中添加performSegue(withIdentifier:sender:)

let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)

alert.addAction(UIAlertAction(title: "Ja", style: .default, handler: { (action) in

    print ("Jag vill gå tillbaka")
    // call the segue at hare
    self.performSegue(withIdentifier:"SegueIdentifer", sender: nil)
}))

alert.addAction(UIAlertAction(title: "Nej", style: .default, handler: { (action) in

    print("Nej, jag vill inte gå tillbaka")
}))

self.present(alert, animated: true)

There is no need to call dismiss with alert it will automatically dismiss the alert when you press any action of AlertController.

So simply add performSegue(withIdentifier:sender:) with your action.

let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)

alert.addAction(UIAlertAction(title: "Ja", style: .default, handler: { (action) in

    print ("Jag vill gå tillbaka")
    // call the segue at hare
    self.performSegue(withIdentifier:"SegueIdentifer", sender: nil)
}))

alert.addAction(UIAlertAction(title: "Nej", style: .default, handler: { (action) in

    print("Nej, jag vill inte gå tillbaka")
}))

self.present(alert, animated: true)

相关问答

更多
  • 这应该非常简单。 只需在else语句中添加以下简短示例代码: let alert = UIAlertController(title: "Your title", message: "Your message", preferredStyle: .Alert) alert.addAction(UIAlertAction(title: "Ok", style: .Default, handler: nil)) presentViewController(alert, animated: true, compl ...
  • 您的代码无法正确设置警报视图的委托。 您需要更改以下行,以便委托是适当的对象(例如, self ): UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:@"my message" delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:@"set",nil]; Your code doesn't correctly set th ...
  • 要小心,在if语句中应该是==。 除此之外,您如何为alertviews分配标签? Be careful, it should be == in your if statements. Apart from that, how do you assign tags to the alertviews?
  • 这可能违反HIG指导原则,不会解雇UIAlertView。 解决方法:我不知道应用程序中发生了什么,但为了实现此目的,您可以执行的操作是关闭AlertView,然后检查textView的文本是否已设置。 如果它设置为零,则再次调出alertview! That might be against HIG Guidelines to NOT to dismiss an UIAlertView. WORKAROUND : I don't know what goes on in your app, but to ...
  • 我猜想警报1显示,然后由警报2覆盖,因为显示不是模态。 当警报2关闭时,警报1仍然打开。 对于第二个问题, alertView:didDismissWithButtonIndex:可能会更好,但我没有真正测试过。 I would guess that alert 1 is shown and then covered by alert 2 since show isn't modal. When alert 2 is closed, alert 1 is still open. To your second ...
  • 您的AlertView正在显示,因为您的应用即将在Notification Center显示时自动重新启动,并且您将从处理此转换的appDelegate方法启动它。 你想要完成什么? 您的应用无法阻止通知中心显示,或者无法通过AlertView以编程方式打开它。 您可以在表2-3中查看iOS应用程序状态: iOS App生命周期 Your AlertView is showing because your app is about to resign active as Notification Cente ...
  • 设置一个延迟的performSelector ,以便在完成初始化时,UIAertView将显示。 或者在根视图中显示警报。 Ok, thanks for the hints but I figured it out. It needed a performSelectorOnMainThread wait(NO) [self performSelectorOnMainThread:@selector(checkDownloads) withObject:nil waitUntilDone:NO]; on ...
  • 你可能需要做两件事之一。 第一个选项是为您的班级中的电话号码设置ivar或属性: @implementation SomeViewController { NSString* _phoneNumber; } - (void) alertView: (UIAlertView *)alertView clickedButtonAtIndex (NSInteger)buttonIndex { // Capture the phone number input from the alert pop ...
  • prepareForSegue:sender:在即将执行segue时调用。 你不能在那时取消它。 如果你想取消segue,你应该重写的方法是shouldPerformSegueWithIdentifier:sender: . prepareForSegue:sender: is called when the segue is about to be performed. You cannot cancel it at that point. The method you should be overrid ...
  • 没有必要通过警报调用dismiss它会在你按下AlertController任何动作时自动解除警报。 因此,只需在您的操作中添加performSegue(withIdentifier:sender:) 。 let alert = UIAlertController(title: title, message: message, preferredStyle: .alert) alert.addAction(UIAlertAction(title: "Ja", style: .default, handle ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。