1

Which one is good for better performance ?

asked 2014-03-14 06:16:19 +0800

jaideep gravatar image jaideep flag of India
178 5

updated 2014-03-14 06:17:26 +0800

We are using @Command method for firing any method but we are using @NotifyChange method for reflecting the class variables. But In place of @NotifyChange we use

BindUtils.postNotifyChange(null, null, this.class, "*");

So which statement is good for better performance.

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2014-03-14 06:25:38 +0800

sitansu gravatar image sitansu
2254 13
http://java91.blogspot.in...

updated 2014-03-14 06:47:38 +0800

Before I put this question in SO look at here:

http://stackoverflow.com/questions/19977102/is-it-possible-use-notifychange-instead-of-bindutils-postnotifychange

I personally suggest to use specific variable instead of "*" And its not better performancewise BindUtils.postNotifyChange(null, null, this.class, "*");

The basic difference beetween BindUtils and @NotifyChange :

BindUtils just takes a single property and @NotifyChange takes multiple property at a time.

link publish delete flag offensive edit

Comments

But sitansu which loads our result more faster after reflecting

jaideep ( 2014-03-14 06:30:42 +0800 )edit

I edit my answer see here

sitansu ( 2014-03-14 06:32:42 +0800 )edit
1

answered 2014-03-14 06:48:44 +0800

chillworld gravatar image chillworld flag of Belgium
5337 4 9
https://github.com/chillw...

updated 2014-04-03 08:28:55 +0800

Actually, BindUtils can be more powerfull then @NotifyChanged If you are gonna use it in the same way I don't think there is a big difference.

Now, when will there a difference?
Assume you have a list what you get with this :

public List<User> getUsers() {
    return users;
}

Assume that we have buttons next to each user and the button fires a command that changes that user (like blocking that user) What we can do is put the @notifyChanged("users") what will mean in zk asking getUsers();

If we use BindUtils we can do the following :

BindUtils.postNotifyChanged(null,null,user,"*");

or

BindUtils.postNotifyCHanged(null,null,user,"blocked");

Where blocked stands for a getter inside the User object.

Even we don't have a getter for that user in our VM this will still be executed and only that user in the whole list will update. With the first command all data is refreshed, with the second only the blocked is updated. Now the second isn't always possible cause maybe you don't know what field of all fields is updated but still you update 1 user in stead of getting all x users.

greetz chill.

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: 2014-03-14 06:16:19 +0800

Seen: 42 times

Last updated: Apr 03 '14

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