org.epics.pvmanager
Class PV<T>

java.lang.Object
  extended by org.epics.pvmanager.PV<T>
Type Parameters:
T - the type of the PV.

public final class PV<T>
extends java.lang.Object

An object representing the PV. It contains all elements that are common to all PVs of all type. The payload is specified by the generic type, and is returned by getValue(). Changes in values are notified through the PVValueChangeListener. Listeners can be registered from any thread. The value can only be accessed on the thread on which the listeners is called.

Author:
carcassi

Method Summary
 void addPVValueChangeListener(java.lang.Class<?> clazz, PVValueChangeListener listener)
          Adds a listener to the value, which is notified only if the value is of a given type.
 void addPVValueChangeListener(PVValueChangeListener listener)
          Adds a listener to the value.
 void close()
          De-registers all listeners, stops all notifications and closes all connections from the data sources needed by this.
 java.lang.String getName()
          Returns the name of the PV.
 T getValue()
          Returns the value of the PV.
 boolean isClosed()
          True if no more notifications are going to be sent for this PV.
 java.lang.Exception lastException()
          Returns the last exception that was generated preparing the value for this PV and clears it (subsequent call will return null).
 void removePVValueChangeListener(PVValueChangeListener listener)
          Adds a listener to the value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addPVValueChangeListener

public void addPVValueChangeListener(PVValueChangeListener listener)
Adds a listener to the value. This method is thread safe.

Parameters:
listener - a new listener

addPVValueChangeListener

public void addPVValueChangeListener(java.lang.Class<?> clazz,
                                     PVValueChangeListener listener)
Adds a listener to the value, which is notified only if the value is of a given type. This method is thread safe.

Parameters:
listener - a new listener

removePVValueChangeListener

public void removePVValueChangeListener(PVValueChangeListener listener)
Adds a listener to the value. This method is thread safe.

Parameters:
listener - a new listener

getName

public java.lang.String getName()
Returns the name of the PV. This method is thread safe.

Returns:
the value of name

getValue

public T getValue()
Returns the value of the PV. Not thread safe: can be safely accessed only as part of the PVValueChangeListener.

Returns:
the value of value

close

public void close()
De-registers all listeners, stops all notifications and closes all connections from the data sources needed by this. Once the PV is closed, it can't be re-opened. Subsequent calls to close do not do anything.


isClosed

public boolean isClosed()
True if no more notifications are going to be sent for this PV.

Returns:
true if closed

lastException

public java.lang.Exception lastException()
Returns the last exception that was generated preparing the value for this PV and clears it (subsequent call will return null).

Returns:
the last generated exception or null


Copyright © 2011. All Rights Reserved.