1

It would be real handy if one could listen to class reloads in jRebel to reload for instance static variables when one needs to, for instance in development mode.

Is this possible?

mjs
  • 21,431
  • 31
  • 118
  • 200

1 Answers1

2

Depends on your exact requirements. If it is enough for you to do something with the single static class that is reloaded, then you can implement the following method in that class:

  public static void __rebelReload(){
    // do whatever stuff you want with the static state
  }

After the class is reloaded, JRebel will call this method.

However, if the static state is scattered across the application, you may want to implement a custom plugin, which is just a bit more complicated to do.

Anton Arhipov
  • 6,479
  • 1
  • 35
  • 43
  • Thanks, but I would like to be notified of any class reload changes. One major event. This would force me to have this method on all methods. I will look into the plugin way. – mjs Aug 12 '14 at 07:55
  • In that case, plugin is the way to go. ClassEventListener#onClassEvent is the method where your logic will be implemented. – Anton Arhipov Aug 12 '14 at 16:12