将@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 ofAlertController
.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声明中的AlertView(AlertView in Else Statement)[2022-04-19]
这应该非常简单。 只需在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 ...
-
为什么这个alertView代码不起作用?(Why is this alertView code not working? No error, just not doing as it should)[2022-07-12]
要小心,在if语句中应该是==。 除此之外,您如何为alertviews分配标签? Be careful, it should be == in your if statements. Apart from that, how do you assign tags to the alertviews? -
防止AlertView解雇(Prevent AlertView dismissal)[2024-02-10]
这可能违反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 ...
-
ApplicationDidFinishLaunching中的AlertView问题(Problem with AlertView in ApplicationDidFinishLaunching)[2022-02-20]
设置一个延迟的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 ... -
使用AlertView文本输入(Using AlertView Text Input)[2022-04-28]
你可能需要做两件事之一。 第一个选项是为您的班级中的电话号码设置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 ...
-
如何使用AlertView进行调整?(How to segue with AlertView?)[2024-02-11]
没有必要通过警报调用dismiss它会在你按下AlertController任何动作时自动解除警报。 因此,只需在您的操作中添加performSegue(withIdentifier:sender:) 。 let alert = UIAlertController(title: title, message: message, preferredStyle: .alert) alert.addAction(UIAlertAction(title: "Ja", style: .default, handle ...