These are the interfaces for adding plugins to the Grid core framework.
Overview
These plugins can be added into ObjectGrid in several ways such as xml configuration, programmatically adding, or using annotation.
Annotation based callbacks
ObjectGrid when running on Java 5 will start to use an annotated method callback system. This means that
objects can be registered as callbacks or listeners. The methods on the object must be annotated as to be
invoked for a certain event. Unannotated methods are not invoked. The name of the method is unimportant. The
method arguments and return type must be the same as expected for the callback method.
Why?
Usually, callbacks are specified using an interface. This works well but results in a possible performance loss
as all methods on the interface will be invoked by the ObjectGrid even though the application is only
interested in a single event. This wastes precious resources. Another issue is when we need to add a new
event. Adding a new method to an existing interface breaks back wards compatibility. We can make a new interface
extending the old one with the new methods but this is also undesirable as soon there are many interfaces
in the hierarchy as new events are added. The annotation system allows the application to only mark methods
to be called avoiding the first problem and if new event types are added they have no impact on existing callback
objects. Newer applications can add a method and annotate it with the new event annotation to receive the
event.