Search code examples
javaobserver-pattern

Observer for each method of a class


I want to keep observer for each method in java i.e. if any of method is called, i should be notified. or if any of member variable is updated, i should be notified. Is there any java framework to do that ?


Solution

  • You should have a look at AspectJ. This framework allows you to add hooks for method invocations and field updates.