This issue is about refactoring of the lifecycle callback classes. The goal is API consistency and ease of use. Technically callback API hasn't been officially released as of the date the issue is created, so API changing is not a big deal, however since the API was advertised on the user list for more than a few months already, documenting all the changes is a courtesy to the early adopters.
- Moving callback type constants (PRE_PERSIST, POST_PERSIST, ...) from LifecycleEventCallback to org.apache.cayenne.map.CallbackMethod, as this information is used in the raw mapping as well as in compiled descriptors.
- Introducing org.apache.cayenne.LifecycleListener as an optional callback interface to simplify manual callback registration.
- Moving all runtime callback handling classes to "reflect" package from "map".
- Making LifecycleEventCallback a non-public class instead of a public interface - it is used internally, and shouldn't be invoked by the users.
- Introducing org.apache.cayenne.reflect.LifecycleCallbackRegistry class . It keeps a collection of handlers for all event types. This is the public class that deals with callbacks in runtime.
- Renaming LifecycleEventCallbackMap to LifecycleCallbackEventHandler and making most methods non-public (accessed via LifecycleCallbackRegistry).
Will need to document the new API in the User Guide: