Package com.xceptance.xlt.api.engine

# Interface Data

All Known Implementing Classes:
  `AbstractData`, `ActionData`, `CustomData`, `CustomValue`, `EventData`, `PageLoadTimingData`, `RequestData`, `TimerData`, `TransactionData`, `WebVitalData`

public interface Data
The `Data` interface defines the minimum functionality any data record must implement to be recordable by the XLT engine. Typically, the XLT engine already collects sufficient data (e.g. error and run time values). However, it may be necessary to log other important values as well. For this, a new data record type needs to be created, either by implementing this interface or - preferably - by extending from one of the already existing data record types.

Such a data record class must obey the following rules:

- it must define a type code character to enable XLT to tell one type of data record from the other (Note that the type codes 'A', 'C', 'E', 'J', 'P', 'R', 'T', 'V', and 'W' are already used by the XLT engine.)
- it must have a name
- it must have a time stamp
- it must be able to serialize its state as a list of strings
- it must be able to reconstruct its state from a list of strings

Serialization and reconstruction: Note that `toList()` on the one side and `setBaseValues(List)` and `setRemainingValues(List)` on the other side work inversely. The data produced by `toList()` during a load test will later be passed to `setBaseValues(List)` and `setRemainingValues(List)` during report creation. It is the programmer's responsibility to ensure that the implementation of these methods is in sync.

The data record can be logged using the `DataManager`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getAgentName()`
  Returns the name of the agent that produced this data record.
  `String`
  `getName()`
  Returns the name of this data record.
  `long`
  `getTime()`
  Returns the time when the event occurred that this data record was created for.
  `String`
  `getTransactionName()`
  Returns the name of the transaction that produced this data record.
  `char`
  `getTypeCode()`
  Returns the type code of this data record.
  `void`
  `setAgentName(String agentName)`
  Sets the name of the agent that produced this data record.
  `void`
  `setBaseValues(List<XltCharBuffer> values)`
  Called by XLT during report creation to recreate the base object state (type code, name, and timestamp) from the passed string list.
  `void`
  `setName(String name)`
  Sets the name of this data record.
  `void`
  `setRemainingValues(List<XltCharBuffer> values)`
  Called by XLT during report creation to recreate the remaining object state from the passed string list.
  `void`
  `setTime(long time)`
  Sets the time when this record's event occurred.
  `void`
  `setTransactionName(String transactionName)`
  Sets the name of the transaction that produced this data record.
  `List<String>`
  `toList()`
  Called by XLT during a load test to return the full state of the object as a list of strings.

- ## Method Details

  - ### toList

    List<String> toList()
    Called by XLT during a load test to return the full state of the object as a list of strings. The first three entries have to be, in this order, the type code, the name, and the timestamp. All remaining entries and their order are specific to the concrete implementation class.
    Returns:
      the list of values that form the state of this object
    See Also:
      - `setBaseValues(List)`
      - `setRemainingValues(List)`

  - ### setBaseValues

    void setBaseValues(List<XltCharBuffer> values)
    Called by XLT during report creation to recreate the base object state (type code, name, and timestamp) from the passed string list. The remaining values may later be initialized by calling `setRemainingValues(List)` with the same list of values. Splitting the process of recreating the full object state into two methods is purely for performance reasons as the second step is not always needed.
    Parameters:
      `values` - the string list to recreate the object state from
    See Also:
      - `setRemainingValues(List)`
      - `toList()`

  - ### setRemainingValues

    void setRemainingValues(List<XltCharBuffer> values)
    Called by XLT during report creation to recreate the remaining object state from the passed string list. The base values have already been initialized by calling `setBaseValues(List)` with the same list of values. Splitting the process of recreating the full object state into two methods is purely for performance reasons as the second step is not always needed.
    Parameters:
      `values` - the string list to recreate the object state from
    See Also:
      - `setBaseValues(List)`
      - `toList()`

  - ### getAgentName

    String getAgentName()
    Returns the name of the agent that produced this data record. Only used during report generation or analysis.
    Returns:
      the agent's name

  - ### getName

    String getName()
    Returns the name of this data record.
    Returns:
      the name

  - ### getTime

    long getTime()
    Returns the time when the event occurred that this data record was created for.
    Returns:
      the time

  - ### getTransactionName

    String getTransactionName()
    Returns the name of the transaction that produced this data record. Only used during report generation or analysis.
    Returns:
      the transaction's name

  - ### getTypeCode

    char getTypeCode()
    Returns the type code of this data record.
    Returns:
      the type code

  - ### setAgentName

    void setAgentName(String agentName)
    Sets the name of the agent that produced this data record. Only used during report generation or analysis.
    Parameters:
      `agentName` - the agent's name

  - ### setName

    void setName(String name)
    Sets the name of this data record.
    Parameters:
      `name` - the name

  - ### setTime

    void setTime(long time)
    Sets the time when this record's event occurred. To obtain the timestamp, please use `GlobalClock.millis()`.
    Parameters:
      `time` - the timestamp

  - ### setTransactionName

    void setTransactionName(String transactionName)
    Sets the name of the transaction that produced this data record. Only used during report generation or analysis.
    Parameters:
      `transactionName` - the transaction's name