org.epics.pvmanager
Class NotificationSupport<T>

java.lang.Object
  extended by org.epics.pvmanager.TypeSupport<T>
      extended by org.epics.pvmanager.NotificationSupport<T>
Type Parameters:
T - type for which the notifications are prepared

public abstract class NotificationSupport<T>
extends TypeSupport<T>

Dedicated notification type support.

Since:
17.01.2011
Author:
bknerr

Constructor Summary
NotificationSupport(java.lang.Class<T> clazz)
          Creates a new notification type support.
 
Method Summary
static
<T> NotificationSupport<T>
immutableTypeSupport(java.lang.Class<T> clazz)
          Support for notification of immutable types.
static
<T> Notification<T>
notification(T oldValue, T newValue)
          Returns the final value by using the appropriate type support.
abstract  Notification<T> prepareNotification(T oldValue, T newValue)
          Given the old and new value, prepare the final value that will be notified.
 
Methods inherited from class org.epics.pvmanager.TypeSupport
addTypeSupport, findTypeSupportFor, getType, getTypeSupportFamily, isTypeDirectlySupported, isTypeSupported, typeSupportsFor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NotificationSupport

public NotificationSupport(java.lang.Class<T> clazz)
Creates a new notification type support.

Parameters:
clazz - the type being supported
Method Detail

notification

public static <T> Notification<T> notification(T oldValue,
                                               T newValue)
Returns the final value by using the appropriate type support.

Type Parameters:
T - the type of the value
Parameters:
oldValue - the oldValue, which was previously in the previous notification
newValue - the newValue, which was computed during the scanning
Returns:
the value to be notified

prepareNotification

public abstract Notification<T> prepareNotification(T oldValue,
                                                    T newValue)
Given the old and new value, prepare the final value that will be notified. This method is guaranteed to be called in the notification thread (the UI thread). This method may either update the old value or return the new value, depending on whether the type is immutable or what is more efficient.

Parameters:
oldValue - the oldValue, which was previously in the previous notification
newValue - the newValue, which was computed during the scanning
Returns:
the value to be notified

immutableTypeSupport

public static <T> NotificationSupport<T> immutableTypeSupport(java.lang.Class<T> clazz)
Support for notification of immutable types. Notification is enabled if the value changed according to Object.equals(java.lang.Object).

Type Parameters:
T - type for which to add support
Parameters:
clazz - type for which to add support
Returns:
support for immutable objects of the given type