Package org.apache.jmeter.report.core

# Class SampleMetadata

java.lang.Object
org.apache.jmeter.report.core.SampleMetadata

public class SampleMetadata extends Object

Describe samples structure by holding sample column names and theirs matching indexes.

Since:
  3.0

## Constructor Summary

Constructors
Constructor
Description
`SampleMetadata(char separator, String... columns)`
Builds metadata from separator character and a list of column names
`SampleMetadata(SampleSaveConfiguration saveConfig)`
Construct SampleMetaData from `SampleSaveConfiguration`.

## Method Summary

Modifier and Type
Method
Description
`int`
`ensureIndexOf(String col)`
Returns the index of the column with the specified name.
`int`
`getColumnCount()`
`String`
`getColumnName(int i)`
Gets the name of the ith column in this metadata
`String`
`getColumnName(Integer i)`
Gets the name of the ith column in this metadata
`char`
`getSeparator()`
`int`
`indexOf(String col)`
Returns the index of the column with the specified name.
`String`
`toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### SampleMetadata

public SampleMetadata(char separator, String... columns)
Builds metadata from separator character and a list of column names

Parameters:
  `separator` - The character used for column separation
  `columns` - The list of columns names (must not be `null`)

### SampleMetadata

public SampleMetadata(SampleSaveConfiguration saveConfig)
Construct SampleMetaData from `SampleSaveConfiguration`.

Parameters:
  `saveConfig` - config from which metadata gets extracted (must not be `null`)

## Method Details

### getSeparator

public char getSeparator()

Returns:
  the character used for separating columns

### getColumnCount

public int getColumnCount()

Returns:
  the number of columns in the metadata

### getColumnName

public String getColumnName(int i)
Gets the name of the ith column in this metadata

Parameters:
  `i` - The index of the column for which the name is requested (zero based)
Returns:
  The column name of the ith column
Throws:
  `IndexOutOfBoundsException` - If the requested column does not exist (< 0 or > `getColumnCount()`)

### getColumnName

public String getColumnName(Integer i)
Gets the name of the ith column in this metadata

Parameters:
  `i` - The index of the column for which the name is requested (zero based)
Returns:
  The column name of the ith column
Throws:
  `IndexOutOfBoundsException` - If the requested columln does not exist (< 0 or > `getColumnCount()`)

### indexOf

public int indexOf(String col)
Returns the index of the column with the specified name.

Parameters:
  `col` - the column name for which the index is requested
Returns:
  The index of the requested column or -1 if the requested column does not exist in this metadata

### ensureIndexOf

public int ensureIndexOf(String col)
Returns the index of the column with the specified name.

Parameters:
  `col` - the column name for which the index is requested
Returns:
  The index of the requested column
Throws:
  `SampleException` - when the column with the specified name is not found

### toString

public String toString()

Overrides:
  `toString` in class `Object`