Package com.xceptance.xlt.api.engine
Class AbstractData
- java.lang.Object
-
- com.xceptance.xlt.api.engine.AbstractData
-
- All Implemented Interfaces:
Data
- Direct Known Subclasses:
CustomValue,EventData,TimerData
public abstract class AbstractData extends java.lang.Object implements Data
TheAbstractDataclass may be the super class of a special data record class.Import change in 7.0: We are not longer automatically capturing the start time when this object is created for performance reasons. You have to set the time explicitly.
-
-
Constructor Summary
Constructors Constructor Description AbstractData(char typeCode)Creates a new AbstractData object and gives it the specified type code.AbstractData(java.lang.String name, char typeCode)Creates a new AbstractData object and gives it the specified name and type code.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.util.List<java.lang.String>addValues()Builds a list of string values that represents the state of this object.voidbaseValuesFromCSV(SimpleArrayList<XltCharBuffer> result, XltCharBuffer s)Recreates a partial state of this object by reading the data from a buffer s and parsing it as comma-delimited line.java.lang.StringgetAgentName()Returns the name of the agent that produced this data record.protected intgetMinNoCSVElements()Returns the minimum number of elements in the CSV string.java.lang.StringgetName()Returns the name of this data record.longgetTime()Returns the time when the event occurred that this data record was created for.java.lang.StringgetTransactionName()Returns the name of the transaction that produced this data record.chargetTypeCode()Returns the type code of this data record.protected voidparseBaseValues(java.util.List<XltCharBuffer> values)Recreates the base state: type code, name, and time.protected abstract voidparseRemainingValues(java.util.List<XltCharBuffer> values)Recreates the state of this object from an array of values.voidparseValues(SimpleArrayList<XltCharBuffer> result)Mainly for testing, we can recreate the state from a list at oncevoidremainingValuesFromCSV(SimpleArrayList<XltCharBuffer> result)Recreates the full state of the object by parsing the remaining data of the passed list.voidsetAgentName(java.lang.String agentName)Sets the name of the agent that produced this data record.voidsetName(java.lang.String name)Sets the name of this data record.voidsetTime(long time)Sets the time when this record's event occurred.voidsetTransactionName(java.lang.String transactionName)Sets the name of the transaction that produced this data record.java.lang.StringBuildertoCSV()Returns the state of this object as a StringBuilder reflecting a list of values separated by the DELIMITER constant.
-
-
-
Constructor Detail
-
AbstractData
public AbstractData(java.lang.String name, char typeCode)Creates a new AbstractData object and gives it the specified name and type code.- Parameters:
name- the request nametypeCode- the type code
-
AbstractData
public AbstractData(char typeCode)
Creates a new AbstractData object and gives it the specified type code.- Parameters:
typeCode- the type code
-
-
Method Detail
-
baseValuesFromCSV
public final void baseValuesFromCSV(SimpleArrayList<XltCharBuffer> result, XltCharBuffer s)
Recreates a partial state of this object by reading the data from a buffer s and parsing it as comma-delimited line. The result is an empty reusable object that is here for speed not functionality. The data will be internally stored and only the most essential state will be recreated first, because later we might filter things out anyway, so why waste cycles. The passed list must be empty and it will be mutated to hold the full parse result.- Specified by:
baseValuesFromCSVin interfaceData- Parameters:
result- reusable list for the parsing resultss- the csv data as charbuffer
-
parseValues
public final void parseValues(SimpleArrayList<XltCharBuffer> result)
Mainly for testing, we can recreate the state from a list at once
-
remainingValuesFromCSV
public final void remainingValuesFromCSV(SimpleArrayList<XltCharBuffer> result)
Recreates the full state of the object by parsing the remaining data of the passed list. It is the programmers responsibility to make sure that the result list matches the one initially created when calling baseValuesFromCSV. This is an implementation focusing on speed not a nice API aka you can reuse a list over and over again as long as the calling order is right.- Specified by:
remainingValuesFromCSVin interfaceData- Parameters:
result- the previously parsed data as list
-
getAgentName
public java.lang.String getAgentName()
Returns the name of the agent that produced this data record. Only used during report generation or analysis.- Specified by:
getAgentNamein interfaceData- Returns:
- the agent's name
-
getName
public java.lang.String getName()
Returns the name of this data record.
-
getTime
public long getTime()
Returns the time when the event occurred that this data record was created for.
-
getTransactionName
public java.lang.String getTransactionName()
Returns the name of the transaction that produced this data record. Only used during report generation or analysis.- Specified by:
getTransactionNamein interfaceData- Returns:
- the transaction's name
-
getTypeCode
public char getTypeCode()
Returns the type code of this data record.- Specified by:
getTypeCodein interfaceData- Returns:
- the type code
-
setAgentName
public void setAgentName(java.lang.String agentName)
Sets the name of the agent that produced this data record. Only used during report generation or analysis.- Specified by:
setAgentNamein interfaceData- Parameters:
agentName- the agent's name
-
setName
public void setName(java.lang.String name)
Sets the name of this data record.
-
setTime
public void setTime(long time)
Sets the time when this record's event occurred. To obtain the timestamp, please useGlobalClock.millis().
-
setTransactionName
public void setTransactionName(java.lang.String transactionName)
Sets the name of the transaction that produced this data record. Only used during report generation or analysis.- Specified by:
setTransactionNamein interfaceData- Parameters:
transactionName- the transaction's name
-
toCSV
public final java.lang.StringBuilder toCSV()
Returns the state of this object as a StringBuilder reflecting a list of values separated by the DELIMITER constant.
-
addValues
protected java.util.List<java.lang.String> addValues()
Builds a list of string values that represents the state of this object. Override this method in sub classes to add custom values and use the list created by the super class.- Returns:
- the list of values
-
getMinNoCSVElements
protected int getMinNoCSVElements()
Returns the minimum number of elements in the CSV string.- Returns:
- minimum number of elements in the CSV string
-
parseBaseValues
protected void parseBaseValues(java.util.List<XltCharBuffer> values)
Recreates the base state: type code, name, and time.- Parameters:
values- the list of values, must have at least the lengthgetMinNoCSVElements()
-
parseRemainingValues
protected abstract void parseRemainingValues(java.util.List<XltCharBuffer> values)
Recreates the state of this object from an array of values. Override this method in sub classes to restore custom values.- Parameters:
values- the list of values, must have at least the lengthgetMinNoCSVElements()
-
-