0

Add @DependsOn dynamic on method

asked 2018-06-16 04:28:27 +0800

caiofilipemr gravatar image caiofilipemr
5 2

Hello,

Is it possible to add dynamically a @DependsOn annotation to a method? By reflection or some ZK method?

The reason is: my object will only know @DependsOn object name on runtime.

Thanks in advance.

delete flag offensive retag edit

Comments

There is BindUtils.postnotifyChange. can that help you?

chillworld ( 2018-06-17 04:16:52 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-06-25 10:50:39 +0800

cor3000 gravatar image cor3000
4143 1 7
ZK Team

updated 2018-06-25 10:51:57 +0800

That's quite a rare question and I haven't tested this yet. Here's where I'd put a breakpoint to see how ZK does it internally when it encounters the annotation:

https://github.com/zkoss/zk/blob/v8.5.1.2/zkbind/src/org/zkoss/bind/xel/zel/BindELContext.java#L326

I assume the 3 String based parameters will be straight forward. Except for the first parameter Binding srcBinding. You'll need to find it inside the current Binder instance:

e.g. in your @Init-method of your ViewModel:

@Init
public void init(@ContextParam(ContextType.BINDER BinderCtrl binderCtrl) {
  binderCtrl.getLoadPromptBindings(...);
}

see: https://github.com/zkoss/zk/blob/v8.5.1.2/zkbind/src/org/zkoss/bind/sys/BinderCtrl.java#L171

As said I haven't tested this, nor do I exactly know that's what you want. However I'd start looking/testing there.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2018-06-16 04:28:27 +0800

Seen: 10 times

Last updated: Jun 25

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More