Class JavaSamplerContext
-
- All Implemented Interfaces:
public class JavaSamplerContextJavaSamplerContext is used to provide context information to a JavaSamplerClient implementation. This currently consists of the initialization parameters which were specified in the GUI. Additional data may be accessible through JavaSamplerContext in the future.
-
-
Constructor Summary
Constructors Constructor Description JavaSamplerContext(Arguments args)Create a new JavaSampler with the specified initialization parameters.
-
Method Summary
Modifier and Type Method Description booleancontainsParameter(String name)Determine whether or not a value has been specified for the parameter with this name. Iterator<String>getParameterNamesIterator()Get an iterator of the parameter names. StringgetParameter(String name)Get the value of a specific parameter as a String, or null if the value was not specified. StringgetParameter(String name, String defaultValue)Get the value of a specified parameter as a String, or return the specified default value if the value was not specified. intgetIntParameter(String name)Get the value of a specified parameter as an integer. intgetIntParameter(String name, int defaultValue)Get the value of a specified parameter as an integer, or return the specified default value if the value was not specified or is not an integer. longgetLongParameter(String name)Get the value of a specified parameter as a long. longgetLongParameter(String name, long defaultValue)Get the value of a specified parameter as along, or return the specified default value if the value was not specified or is not a long. JMeterContextgetJMeterContext()Returns JMeterContext for the current thread. static JMeterVariablesgetJMeterVariables()Returns JMeterVariables for the current thread. static PropertiesgetJMeterProperties()Returns JMeter properties. -
-
Method Detail
-
containsParameter
boolean containsParameter(String name)
Determine whether or not a value has been specified for the parameter with this name.
- Parameters:
name- the name of the parameter to test
-
getParameterNamesIterator
Iterator<String> getParameterNamesIterator()
Get an iterator of the parameter names. Each entry in the Iterator is a String.
-
getParameter
String getParameter(String name)
Get the value of a specific parameter as a String, or null if the value was not specified.
- Parameters:
name- the name of the parameter whose value should be retrieved
-
getParameter
String getParameter(String name, String defaultValue)
Get the value of a specified parameter as a String, or return the specified default value if the value was not specified.
- Parameters:
name- the name of the parameter whose value should be retrieveddefaultValue- the default value to return if the value of this parameter was not specified
-
getIntParameter
int getIntParameter(String name)
Get the value of a specified parameter as an integer. An exception will be thrown if the parameter is not specified or if it is not an integer. The value may be specified in decimal, hexadecimal, or octal, as defined by Integer.decode().
- Parameters:
name- the name of the parameter whose value should be retrieved
-
getIntParameter
int getIntParameter(String name, int defaultValue)
Get the value of a specified parameter as an integer, or return the specified default value if the value was not specified or is not an integer. A warning will be logged if the value is not an integer. The value may be specified in decimal, hexadecimal, or octal, as defined by Integer.decode().
- Parameters:
name- the name of the parameter whose value should be retrieveddefaultValue- the default value to return if the value of this parameter was not specified
-
getLongParameter
long getLongParameter(String name)
Get the value of a specified parameter as a long. An exception will be thrown if the parameter is not specified or if it is not a long. The value may be specified in decimal, hexadecimal, or octal, as defined by Long.decode().
- Parameters:
name- the name of the parameter whose value should be retrieved
-
getLongParameter
long getLongParameter(String name, long defaultValue)
Get the value of a specified parameter as along, or return the specified default value if the value was not specified or is not a long. A warning will be logged if the value is not a long. The value may be specified in decimal, hexadecimal, or octal, as defined by Long.decode().
- Parameters:
name- the name of the parameter whose value should be retrieveddefaultValue- the default value to return if the value of this parameter was not specified
-
getJMeterContext
JMeterContext getJMeterContext()
Returns JMeterContext for the current thread.
-
getJMeterVariables
static JMeterVariables getJMeterVariables()
Returns JMeterVariables for the current thread.
-
getJMeterProperties
static Properties getJMeterProperties()
Returns JMeter properties.
-
-
-
-