Class CMUserEvent


public class CMUserEvent extends CMEvent
The CMUserEvent is a user-defined event that can consist of different types of arbitrary fields.
  • Constructor Details

    • CMUserEvent

      public CMUserEvent()
      Creates an instance of the CMUserEvent.
    • CMUserEvent

      public CMUserEvent(ByteBuffer msg)
  • Method Details

    • getAllEventFields

      public Vector<CMUserEventField> getAllEventFields()
      Returns a list of all event fields.
      Returns:
      the list of event fields.
    • setStringID

      public void setStringID(String strID)
      Sets a string ID of this event.
      Parameters:
      strID - - the string ID.
    • getStringID

      public String getStringID()
      Returns the string ID of this event.
      Returns:
      - the string ID.
      The initial value is "defaultID".
    • setEventField

      public void setEventField(int nDataType, String strFieldName, String strFieldValue)
      Sets and adds a new event field to this event.
      Parameters:
      nDataType - - the data type of the field.

      The following 5 types are possible:
      CMInfo.CM_INT : int type
      CMInfo.CM_LONG : long type
      CMInfo.CM_FLOAT : float type
      CMInfo.CM_DOUBLE : double type
      CMInfo.CM_STR : String

      strFieldName - - the field name.
      strFieldValue - - the field value.
    • setEventBytesField

      public void setEventBytesField(String strFieldName, int nByteNum, byte[] bytes)
      Sets and adds bytes data as a new field to this event.
      Parameters:
      strFieldName - - the field name.
      nByteNum - - the number of bytes.
      bytes - - the byte array.
    • getEventField

      public String getEventField(int nDataType, String strFieldName)
      Returns the field value in this event.
      Parameters:
      nDataType - - the field type.

      The field type is one of followings:
      CMInfo.CM_INT : int type
      CMInfo.CM_LONG : long type
      CMInfo.CM_FLOAT : float type
      CMInfo.CM_DOUBLE : double type
      CMInfo.CM_STR : String

      strFieldName - - the field name.
      Returns:
      - the field value if the field is found; null otherwise.
    • getEventBytesField

      public byte[] getEventBytesField(String strFieldName)
      Returns the byte array of the given field.
      Parameters:
      strFieldName - - the field name
      Returns:
      - the byte array if the field is found; null otherwise.
    • findEventField

      public CMUserEventField findEventField(int nDataType, String strFieldName)
      Searches for the event field.
      Parameters:
      nDataType - - the field type.

      The field type is one of followings:
      CMInfo.CM_INT : int type
      CMInfo.CM_LONG : long type
      CMInfo.CM_FLOAT : float type
      CMInfo.CM_DOUBLE : double type
      CMInfo.CM_STR : String

      strFieldName - - the field name.
      Returns:
      the event field if found; null otherwise.
    • removeEventField

      public void removeEventField(int nDataType, String strFieldName)
      Removes an event field from this event.
      Parameters:
      nDataType - - the field type.

      The field type is one of followings:
      CMInfo.CM_INT : int type
      CMInfo.CM_LONG : long type
      CMInfo.CM_FLOAT : float type
      CMInfo.CM_DOUBLE : double type
      CMInfo.CM_STR : String

      strFieldName - - field name.
    • removeAllEventFields

      public void removeAllEventFields()
      Removes all fields of this event.
    • getByteNum

      protected int getByteNum()
      Overrides:
      getByteNum in class CMEvent
    • marshallBody

      protected void marshallBody()
      Specified by:
      marshallBody in class CMEvent
    • unmarshallBody

      protected void unmarshallBody(ByteBuffer msg)
      Specified by:
      unmarshallBody in class CMEvent