Skip Headers

# Using Java

Previous

Next

Example: DescriptorEventListener shows a `DescriptorEventListener` that handles `PostBuildEvent` descriptor events. Example: Registering a DescriptorEventListener with the DescriptorEventManager shows how to register this `DescriptorEventListener` with the `Employee` object's descriptor. Whenever the TopLink runtime performs a post-build operation on an instance of `Employee`, the runtime will dispatch a post build event to the corresponding `DescriptorEventListener` method on each registered event listener (in this case, it calls the `postBuild` method).

DescriptorEventListener

    public class MyDescriptorEventListener extends DescriptorEventAdapter {
        public void postBuild(DescriptorEvent event) {
            // handler implementation
        }
    }

Registering a DescriptorEventListener with the DescriptorEventManager

    descriptor.getEventManager().addListener(new MyDescriptorEventListener());