0

Reset all VM properties

asked 2019-02-02 04:46:04 +0800

psinalberth gravatar image psinalberth
52 6

Hi, is there a way to reset all properties inside a VM?

public class VM {
  private Integer year;
  private Object selected;
  ...
  // Getters and setters
}

I intend to click a button and reset all of them. If I do something like setSelected(null); and BindUtils.postNotifyChange(null, null, this, "selected");, selected property will be reset, but I'd like to do it automatically, since VM is a superclass and subclasses may have many other properties;

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-02-02 17:22:08 +0800

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

You can make the command in the superclass. Create also an abstract method reset, what you can implement in all your subclasses and call that method. Then do a notifychange of all the properties.

I think this is one of the simplest and best solutions there is.

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: 2019-02-02 04:46:04 +0800

Seen: 6 times

Last updated: Feb 02

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