T
- Managed type parameter@Managed public abstract class Record<T> extends java.lang.Object
This notifier provides an opportunity to see Managed objects modified within a transaction. For example, it could be used for updating records in a database, or for doing a Managed object change log.
Modifier | Constructor and Description |
---|---|
protected |
Record(java.lang.Class<T> klass)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
created(T object)
Notifier method for a created Managed object.
|
void |
deleted(T object)
Notifier method for a deleted Managed object.
|
static Record<?> |
getNotifier(java.lang.Class<?> klass)
Return the currently installed Record notifier for
a Managed class.
|
void |
modified(T object)
Notifier method for a modified Managed object.
|
protected Record(java.lang.Class<T> klass) throws ManagedClassError
Creating an instance automatically installs it
as the record notifier for Managed class T
.
If a notifier is already installed for the class, the new instance replaces the previous instance.
Deleting a notifier automatically uninstalls it.
Notifiers are automatically deleted when the JVM shuts down. Notifiers created in other JVMs are not affected.
A separate notifier may be set for each class in a hierarchy.
If no notifier is installed for a class, it inherits the notifier of its parent.
klass
- The Managed class base to receive notifications for.ManagedClassError
- klass
is not managed.public static Record<?> getNotifier(java.lang.Class<?> klass)
klass
- The class to search.ManagedClassError
- if
klass
is not managed.public void created(T object)
Called for each object created (but not deleted) within the transaction.
object
- The created object.
This may be a subtype of the notifier's managed
class type.public void modified(T object)
Called for each object modified (but not created or deleted) within the transaction.
object
- The modified object.
This may be a subtype of the notifier's managed
class type.public void deleted(T object)
Called when ManagedObject.delete(java.lang.Object)
is called by the application.
object
- The deleted object.
This may be a subtype of the notifier's managed
class type.