org.apache.jmeter.threads

## Class JMeterVariables

- java.lang.Object
- - org.apache.jmeter.threads.JMeterVariables

-     public class JMeterVariables
      extends java.lang.Object

  Class which defines JMeter variables. These are similar to properties, but they are local to a single thread.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JMeterVariables()` Constructor, that preloads the variables from the JMeter properties

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>>` | `entrySet()`
    `java.lang.String` | `get(java.lang.String key)` Gets the value of a variable, converted to a String.
    `int` | `getIteration()`
    `java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.Object>>` | `getIterator()` Gets a read-only Iterator over the variables.
    `java.lang.Object` | `getObject(java.lang.String key)` Gets the value of a variable (not converted to String).
    `java.lang.String` | `getThreadName()`
    `void` | `incIteration()` Increase the current number of iterations
    `void` | `put(java.lang.String key, java.lang.String value)` Creates or updates a variable with a String value.
    `void` | `putAll(JMeterVariables vars)` Updates the variables with all entries found in the variables in `vars`
    `void` | `putAll(java.util.Map<java.lang.String,?> vars)` Updates the variables with all entries found in the `Map` `vars`
    `void` | `putObject(java.lang.String key, java.lang.Object value)` Creates or updates a variable with a value that does not have to be a String.
    `java.lang.Object` | `remove(java.lang.String key)` Remove a variable.

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

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

- - ### Constructor Detail

    - #### JMeterVariables

          public JMeterVariables()

      Constructor, that preloads the variables from the JMeter properties

  - ### Method Detail

    - #### getThreadName

          public java.lang.String getThreadName()

      Returns:
        the name of the currently running thread

    - #### getIteration

          public int getIteration()

      Returns:
        the current number of iterations

    - #### incIteration

          public void incIteration()

      Increase the current number of iterations

    - #### remove

          public java.lang.Object remove(java.lang.String key)

      Remove a variable.
      Parameters:
        `key` - the variable name to remove
      Returns:
        the variable value, or `null` if there was no such variable

    - #### put

          public void put(java.lang.String key,
                          java.lang.String value)

      Creates or updates a variable with a String value.
      Parameters:
        `key` - the variable name
        `value` - the variable value

    - #### putObject

          public void putObject(java.lang.String key,
                                java.lang.Object value)

      Creates or updates a variable with a value that does not have to be a String.
      Parameters:
        `key` - the variable name
        `value` - the variable value

    - #### putAll

          public void putAll(java.util.Map<java.lang.String,?> vars)

      Updates the variables with all entries found in the `Map` `vars`
      Parameters:
        `vars` - map with the entries to be updated

    - #### putAll

          public void putAll(JMeterVariables vars)

      Updates the variables with all entries found in the variables in `vars`
      Parameters:
        `vars` - `JMeterVariables` with the entries to be updated

    - #### get

          public java.lang.String get(java.lang.String key)

      Gets the value of a variable, converted to a String.
      Parameters:
        `key` - the name of the variable
      Returns:
        the value of the variable or a toString called on it if it's non String, or `null` if it does not exist

    - #### getObject

          public java.lang.Object getObject(java.lang.String key)

      Gets the value of a variable (not converted to String).
      Parameters:
        `key` - the name of the variable
      Returns:
        the value of the variable, or `null` if it does not exist

    - #### getIterator

          public java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.Object>> getIterator()

      Gets a read-only Iterator over the variables.
      Returns:
        the iterator

    - #### entrySet

          public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()

      Returns:
        an unmodifiable view of the entries contained in `JMeterVariables`

Copyright © 1998-2018 Apache Software Foundation. All Rights Reserved.