blob: f95c1542037c89e29844c3c62e1cd770daf64133 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Function (Apache JMeter dist API)</title>
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Function (Apache JMeter dist API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><b>Apache JMeter</b></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/apache/jmeter/functions/FileWrapper.html" title="class in org.apache.jmeter.functions"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../org/apache/jmeter/functions/Groovy.html" title="class in org.apache.jmeter.functions"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/jmeter/functions/Function.html" target="_top">Frames</a></li>
<li><a href="Function.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.jmeter.functions</div>
<h2 title="Interface Function" class="title">Interface Function</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><a href="../../../../org/apache/jmeter/functions/AbstractFunction.html" title="class in org.apache.jmeter.functions">AbstractFunction</a>, <a href="../../../../org/apache/jmeter/functions/BeanShell.html" title="class in org.apache.jmeter.functions">BeanShell</a>, <a href="../../../../org/apache/jmeter/functions/ChangeCase.html" title="class in org.apache.jmeter.functions">ChangeCase</a>, <a href="../../../../org/apache/jmeter/functions/CharFunction.html" title="class in org.apache.jmeter.functions">CharFunction</a>, <a href="../../../../org/apache/jmeter/engine/util/CompoundVariable.html" title="class in org.apache.jmeter.engine.util">CompoundVariable</a>, <a href="../../../../org/apache/jmeter/functions/CSVRead.html" title="class in org.apache.jmeter.functions">CSVRead</a>, <a href="../../../../org/apache/jmeter/functions/DateTimeConvertFunction.html" title="class in org.apache.jmeter.functions">DateTimeConvertFunction</a>, <a href="../../../../org/apache/jmeter/functions/DigestEncodeFunction.html" title="class in org.apache.jmeter.functions">DigestEncodeFunction</a>, <a href="../../../../org/apache/jmeter/functions/EscapeHtml.html" title="class in org.apache.jmeter.functions">EscapeHtml</a>, <a href="../../../../org/apache/jmeter/functions/EscapeOroRegexpChars.html" title="class in org.apache.jmeter.functions">EscapeOroRegexpChars</a>, <a href="../../../../org/apache/jmeter/functions/EscapeXml.html" title="class in org.apache.jmeter.functions">EscapeXml</a>, <a href="../../../../org/apache/jmeter/functions/EvalFunction.html" title="class in org.apache.jmeter.functions">EvalFunction</a>, <a href="../../../../org/apache/jmeter/functions/EvalVarFunction.html" title="class in org.apache.jmeter.functions">EvalVarFunction</a>, <a href="../../../../org/apache/jmeter/functions/FileToString.html" title="class in org.apache.jmeter.functions">FileToString</a>, <a href="../../../../org/apache/jmeter/functions/Groovy.html" title="class in org.apache.jmeter.functions">Groovy</a>, <a href="../../../../org/apache/jmeter/functions/IntSum.html" title="class in org.apache.jmeter.functions">IntSum</a>, <a href="../../../../org/apache/jmeter/functions/IsPropDefined.html" title="class in org.apache.jmeter.functions">IsPropDefined</a>, <a href="../../../../org/apache/jmeter/functions/IsVarDefined.html" title="class in org.apache.jmeter.functions">IsVarDefined</a>, <a href="../../../../org/apache/jmeter/functions/IterationCounter.html" title="class in org.apache.jmeter.functions">IterationCounter</a>, <a href="../../../../org/apache/jmeter/functions/JavaScript.html" title="class in org.apache.jmeter.functions">JavaScript</a>, <a href="../../../../org/apache/jmeter/functions/Jexl2Function.html" title="class in org.apache.jmeter.functions">Jexl2Function</a>, <a href="../../../../org/apache/jmeter/functions/Jexl3Function.html" title="class in org.apache.jmeter.functions">Jexl3Function</a>, <a href="../../../../org/apache/jmeter/functions/LogFunction.html" title="class in org.apache.jmeter.functions">LogFunction</a>, <a href="../../../../org/apache/jmeter/functions/LogFunction2.html" title="class in org.apache.jmeter.functions">LogFunction2</a>, <a href="../../../../org/apache/jmeter/functions/LongSum.html" title="class in org.apache.jmeter.functions">LongSum</a>, <a href="../../../../org/apache/jmeter/functions/MachineIP.html" title="class in org.apache.jmeter.functions">MachineIP</a>, <a href="../../../../org/apache/jmeter/functions/MachineName.html" title="class in org.apache.jmeter.functions">MachineName</a>, <a href="../../../../org/apache/jmeter/functions/Property.html" title="class in org.apache.jmeter.functions">Property</a>, <a href="../../../../org/apache/jmeter/functions/Property2.html" title="class in org.apache.jmeter.functions">Property2</a>, <a href="../../../../org/apache/jmeter/functions/Random.html" title="class in org.apache.jmeter.functions">Random</a>, <a href="../../../../org/apache/jmeter/functions/RandomDate.html" title="class in org.apache.jmeter.functions">RandomDate</a>, <a href="../../../../org/apache/jmeter/functions/RandomFromMultipleVars.html" title="class in org.apache.jmeter.functions">RandomFromMultipleVars</a>, <a href="../../../../org/apache/jmeter/functions/RandomString.html" title="class in org.apache.jmeter.functions">RandomString</a>, <a href="../../../../org/apache/jmeter/functions/RegexFunction.html" title="class in org.apache.jmeter.functions">RegexFunction</a>, <a href="../../../../org/apache/jmeter/functions/SamplerName.html" title="class in org.apache.jmeter.functions">SamplerName</a>, <a href="../../../../org/apache/jmeter/functions/SetProperty.html" title="class in org.apache.jmeter.functions">SetProperty</a>, <a href="../../../../org/apache/jmeter/functions/SplitFunction.html" title="class in org.apache.jmeter.functions">SplitFunction</a>, <a href="../../../../org/apache/jmeter/functions/StringFromFile.html" title="class in org.apache.jmeter.functions">StringFromFile</a>, <a href="../../../../org/apache/jmeter/functions/StringToFile.html" title="class in org.apache.jmeter.functions">StringToFile</a>, <a href="../../../../org/apache/jmeter/functions/TestPlanName.html" title="class in org.apache.jmeter.functions">TestPlanName</a>, <a href="../../../../org/apache/jmeter/functions/ThreadGroupName.html" title="class in org.apache.jmeter.functions">ThreadGroupName</a>, <a href="../../../../org/apache/jmeter/functions/ThreadNumber.html" title="class in org.apache.jmeter.functions">ThreadNumber</a>, <a href="../../../../org/apache/jmeter/functions/TimeFunction.html" title="class in org.apache.jmeter.functions">TimeFunction</a>, <a href="../../../../org/apache/jmeter/functions/TimeShift.html" title="class in org.apache.jmeter.functions">TimeShift</a>, <a href="../../../../org/apache/jmeter/functions/UnEscape.html" title="class in org.apache.jmeter.functions">UnEscape</a>, <a href="../../../../org/apache/jmeter/functions/UnEscapeHtml.html" title="class in org.apache.jmeter.functions">UnEscapeHtml</a>, <a href="../../../../org/apache/jmeter/functions/UrlDecode.html" title="class in org.apache.jmeter.functions">UrlDecode</a>, <a href="../../../../org/apache/jmeter/functions/UrlEncode.html" title="class in org.apache.jmeter.functions">UrlEncode</a>, <a href="../../../../org/apache/jmeter/functions/Uuid.html" title="class in org.apache.jmeter.functions">Uuid</a>, <a href="../../../../org/apache/jmeter/functions/Variable.html" title="class in org.apache.jmeter.functions">Variable</a>, <a href="../../../../org/apache/jmeter/functions/XPath.html" title="class in org.apache.jmeter.functions">XPath</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="typeNameLabel">Function</span></pre>
<div class="block">Methods that a function must implement</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/jmeter/functions/Function.html#execute-org.apache.jmeter.samplers.SampleResult-org.apache.jmeter.samplers.Sampler-">execute</a></span>(<a href="../../../../org/apache/jmeter/samplers/SampleResult.html" title="class in org.apache.jmeter.samplers">SampleResult</a>&nbsp;previousResult,
<a href="../../../../org/apache/jmeter/samplers/Sampler.html" title="interface in org.apache.jmeter.samplers">Sampler</a>&nbsp;currentSampler)</code>
<div class="block">Given the previous SampleResult and the current Sampler, return a string
to use as a replacement value for the function call.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a>&lt;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/jmeter/functions/Function.html#getArgumentDesc--">getArgumentDesc</a></span>()</code>
<div class="block">Return a list of strings briefly describing each parameter your function
takes.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/jmeter/functions/Function.html#getReferenceKey--">getReferenceKey</a></span>()</code>
<div class="block">Return the name of your function.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/jmeter/functions/Function.html#setParameters-java.util.Collection-">setParameters</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a>&lt;<a href="../../../../org/apache/jmeter/engine/util/CompoundVariable.html" title="class in org.apache.jmeter.engine.util">CompoundVariable</a>&gt;&nbsp;parameters)</code>
<div class="block">A collection of the parameters used to configure your function.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="execute-org.apache.jmeter.samplers.SampleResult-org.apache.jmeter.samplers.Sampler-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>execute</h4>
<pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;execute(<a href="../../../../org/apache/jmeter/samplers/SampleResult.html" title="class in org.apache.jmeter.samplers">SampleResult</a>&nbsp;previousResult,
<a href="../../../../org/apache/jmeter/samplers/Sampler.html" title="interface in org.apache.jmeter.samplers">Sampler</a>&nbsp;currentSampler)
throws <a href="../../../../org/apache/jmeter/functions/InvalidVariableException.html" title="class in org.apache.jmeter.functions">InvalidVariableException</a></pre>
<div class="block">Given the previous SampleResult and the current Sampler, return a string
to use as a replacement value for the function call. Assume
"setParameter" was previously called.
This method must be threadsafe - multiple threads will be using the same
object.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>previousResult</code> - The previous <a href="../../../../org/apache/jmeter/samplers/SampleResult.html" title="class in org.apache.jmeter.samplers"><code>SampleResult</code></a></dd>
<dd><code>currentSampler</code> - The current <a href="../../../../org/apache/jmeter/samplers/Sampler.html" title="interface in org.apache.jmeter.samplers"><code>Sampler</code></a></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The replacement value, which was generated by the function</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../../org/apache/jmeter/functions/InvalidVariableException.html" title="class in org.apache.jmeter.functions">InvalidVariableException</a></code> - - when the variables for the function call can't be evaluated</dd>
</dl>
</li>
</ul>
<a name="setParameters-java.util.Collection-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setParameters</h4>
<pre>void&nbsp;setParameters(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a>&lt;<a href="../../../../org/apache/jmeter/engine/util/CompoundVariable.html" title="class in org.apache.jmeter.engine.util">CompoundVariable</a>&gt;&nbsp;parameters)
throws <a href="../../../../org/apache/jmeter/functions/InvalidVariableException.html" title="class in org.apache.jmeter.functions">InvalidVariableException</a></pre>
<div class="block">A collection of the parameters used to configure your function. Each
parameter is a CompoundVariable and can be resolved by calling the
execute() method of the CompoundVariable (which should be done at
execution.)</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>parameters</code> - The parameters for the function call</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../../org/apache/jmeter/functions/InvalidVariableException.html" title="class in org.apache.jmeter.functions">InvalidVariableException</a></code> - - when the variables for the function call can't be evaluated</dd>
</dl>
</li>
</ul>
<a name="getReferenceKey--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getReferenceKey</h4>
<pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;getReferenceKey()</pre>
<div class="block">Return the name of your function. Convention is to prepend "__" to the
name (ie "__regexFunction")</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The name of the function</dd>
</dl>
</li>
</ul>
<a name="getArgumentDesc--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getArgumentDesc</h4>
<pre><a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a>&lt;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&gt;&nbsp;getArgumentDesc()</pre>
<div class="block">Return a list of strings briefly describing each parameter your function
takes. Please use JMeterUtils.getResString(resource_name) to grab a
resource string. Otherwise, your help text will be difficult to
internationalize.
This list is not optional. If you don't wish to write help, you must at
least return a List containing the correct number of blank strings, one
for each argument.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>List with brief descriptions for each parameter the function takes</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><b>Apache JMeter</b></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/apache/jmeter/functions/FileWrapper.html" title="class in org.apache.jmeter.functions"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../org/apache/jmeter/functions/Groovy.html" title="class in org.apache.jmeter.functions"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/jmeter/functions/Function.html" target="_top">Frames</a></li>
<li><a href="Function.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 1998-2021 Apache Software Foundation. All Rights Reserved.</small></p>
</body>
</html>