com.lightstreamer.ls_client
Interface UpdateInfo


public interface UpdateInfo

Implemented by Lightstreamer to provide information about an update for a subscribed item. The new and previous values for the subscribed fields are reported.
If the table subscription configuration enables the "COMMAND logic", then the old field values are referred to the same key.
Both names and positional information can be used to identify the specific fields, unless a SimpleTableInfo was used to describe the related table; in that case, only positional information can be used.


Method Summary
 java.lang.String getItemName()
          Gets the name of the item involved in the current update, if available.
 int getItemPos()
          Gets positional information for the item involved in the current update.
 java.lang.String getNewValue(int fieldPos)
          Gets the value for a field as it is after the reception of this update.
 java.lang.String getNewValue(java.lang.String fieldName)
          Gets the value for a field as it is after the reception of this update.
 int getNumFields()
          Gets the total number of fields contained in the subscriprion schema.
 java.lang.String getOldValue(int fieldPos)
          Gets the value for a field as it was before the reception of this update.
 java.lang.String getOldValue(java.lang.String fieldName)
          Gets the value for a field as it was before the reception of this update.
 boolean isSnapshot()
          Asks whether the current update pertains to the item snapshot.
 boolean isValueChanged(int fieldPos)
          Asks whether the value for a field has changed after the reception of this update.
 boolean isValueChanged(java.lang.String fieldName)
          Asks whether the value for a field has changed after the reception of this update.
 

Method Detail

getItemPos

int getItemPos()
Gets positional information for the item involved in the current update.

Returns:
the 1-based position of the item in the Group of items in the related table.

getItemName

java.lang.String getItemName()
Gets the name of the item involved in the current update, if available.

Returns:
the item name, or null if a SimpleTableInfo was used to describe the related table.

isValueChanged

boolean isValueChanged(int fieldPos)
Asks whether the value for a field has changed after the reception of this update. For the first update for the item, it always returns true.
If the "COMMAND logic" behaviour is enabled, then the change is meant as relative to the same key; as a consequence, on ADD commands the method always returns true; moreover, on DELETE commands the method returns true for all fields, but for the "key" field.

Parameters:
fieldPos - the 1-based field position within the Schema of fields in the related table.
Returns:
true if the updated value is different than the previous one, according to the above specifications.
Throws:
java.lang.IllegalArgumentException - if the specified field position does not represent a subscribed field.

isValueChanged

boolean isValueChanged(java.lang.String fieldName)
Asks whether the value for a field has changed after the reception of this update. For the first update for the item, it always returns true.
If the "COMMAND logic" behaviour is enabled, then the change is meant as relative to the same key; as a consequence, on ADD commands the method always returns true; moreover, on DELETE commands the method returns true for all fields, but for the "key" field.

Parameters:
fieldName - a field name.
Returns:
true if the updated value is different than the previous one, according to the above specifications.
Throws:
java.lang.IllegalArgumentException - if the specified field name does not represent a subscribed field; also thrown if a SimpleTableInfo was used to describe the related table.

getNewValue

java.lang.String getNewValue(int fieldPos)
Gets the value for a field as it is after the reception of this update.
If the "COMMAND logic" behaviour is enabled and the event carries a DELETE command, then all fields, but for the "key" and "command" fields, have a null new value.

Parameters:
fieldPos - a 1-based field position within the Schema of fields in the related table.
Returns:
the field value, according to the above specifications; null is a legal value too.
Throws:
java.lang.IllegalArgumentException - if the specified field position does not represent a subscribed field.

getNewValue

java.lang.String getNewValue(java.lang.String fieldName)
Gets the value for a field as it is after the reception of this update.
If the "COMMAND logic" behaviour is enabled and the event carries a DELETE command, then all fields, but for the "key" and "command" fields, have a null new value.

Parameters:
fieldName - a field name.
Returns:
the field value, according to the above specifications; null is a legal value too.
Throws:
java.lang.IllegalArgumentException - if the specified field name does not represent a subscribed field; also thrown if a SimpleTableInfo was used to describe the related table.

getOldValue

java.lang.String getOldValue(int fieldPos)
Gets the value for a field as it was before the reception of this update. If the current update is the first one, then all old values are null.
If the "COMMAND logic" behaviour is enabled, then the value is meant as relative to the same key; as a consequence, on ADD commands all old values are null.

Parameters:
fieldPos - a 1-based field position within the Schema of fields in the related table.
Returns:
the previous field value, according to the above specifications; null is a legal value too.
Throws:
java.lang.IllegalArgumentException - if the specified field position does not represent a subscribed field.

getOldValue

java.lang.String getOldValue(java.lang.String fieldName)
Gets the value for a field as it was before the reception of this update. If the current update is the first one, then all old values are null.
If the "COMMAND logic" behaviour is enabled, then the value is meant as relative to the same key; as a consequence, on ADD commands all old values are null.

Parameters:
fieldName - a field name.
Returns:
the previous field value, according to the above specifications; null is a legal value too.
Throws:
java.lang.IllegalArgumentException - if the specified field name does not represent a subscribed field; also thrown if a SimpleTableInfo was used to describe the related table.

getNumFields

int getNumFields()
Gets the total number of fields contained in the subscriprion schema. In case a SimpleTableInfo was used to describe the related table, this number might not be known at subscription time.

Returns:
the number of fields.

isSnapshot

boolean isSnapshot()
Asks whether the current update pertains to the item snapshot.

Returns:
true if the update is from the initial snapshot.