blob: c018ae7b66adf031be8ab4e68bcae708fba1683e [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>VariableManager (Apache JSPWiki 2.12.2-SNAPSHOT API)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
<script type="text/javascript" src="../../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../jquery/jquery-3.5.1.js"></script>
<script type="text/javascript" src="../../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="VariableManager (Apache JSPWiki 2.12.2-SNAPSHOT API)";
}
}
catch(err) {
}
//-->
var data = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":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";
var pathtoroot = "../../../../";
var useModuleDirectories = true;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/VariableManager.html">Use</a></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>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</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>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&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><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">org.apache.wiki.variables</a></div>
<h2 title="Interface VariableManager" class="title">Interface VariableManager</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><code><a href="DefaultVariableManager.html" title="class in org.apache.wiki.variables">DefaultVariableManager</a></code></dd>
</dl>
<hr>
<object type="image/svg+xml" data="VariableManager.svg" style="max-width:60%;float:right;"></object>
<pre style="white-space:pre-wrap;">public interface <a href="../../../../src-html/org/apache/wiki/variables/VariableManager.html#line.29">VariableManager</a></pre>
<div class="block">Manages variables. Variables are case-insensitive. A list of all available variables is on a Wiki page called "WikiVariables".</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.9.20.</dd>
</dl>
</li>
</ul>
</div>
<div class="summary" style="clear:right;">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Field</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#VAR_ERROR">VAR_ERROR</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#VAR_MSG">VAR_MSG</a></span></code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#VAR_RUNFILTERS">VAR_RUNFILTERS</a></span></code></th>
<td class="colLast">
<div class="block">If this variable is set to false, all filters are disabled when translating.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary">
<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="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#expandVariables(org.apache.wiki.api.core.Context,java.lang.String)">expandVariables</a></span>&#8203;(<a href="../api/core/Context.html" title="interface in org.apache.wiki.api.core">Context</a>&nbsp;context,
java.lang.String&nbsp;source)</code></th>
<td class="colLast">
<div class="block">This method does in-place expansion of any variables.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getValue(org.apache.wiki.api.core.Context,java.lang.String)">getValue</a></span>&#8203;(<a href="../api/core/Context.html" title="interface in org.apache.wiki.api.core">Context</a>&nbsp;context,
java.lang.String&nbsp;varName)</code></th>
<td class="colLast">
<div class="block">Returns a value of the named variable.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getValue(org.apache.wiki.api.core.Context,java.lang.String,java.lang.String)">getValue</a></span>&#8203;(<a href="../api/core/Context.html" title="interface in org.apache.wiki.api.core">Context</a>&nbsp;context,
java.lang.String&nbsp;varName,
java.lang.String&nbsp;defValue)</code></th>
<td class="colLast">
<div class="block">Returns the value of a named variable.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getVariable(org.apache.wiki.api.core.Context,java.lang.String)">getVariable</a></span>&#8203;(<a href="../api/core/Context.html" title="interface in org.apache.wiki.api.core">Context</a>&nbsp;context,
java.lang.String&nbsp;name)</code></th>
<td class="colLast">
<div class="block">Shortcut to getValue().</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#parseAndGetValue(org.apache.wiki.api.core.Context,java.lang.String)">parseAndGetValue</a></span>&#8203;(<a href="../api/core/Context.html" title="interface in org.apache.wiki.api.core">Context</a>&nbsp;context,
java.lang.String&nbsp;link)</code></th>
<td class="colLast">
<div class="block">Parses the link and finds a value.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a id="VAR_ERROR">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>VAR_ERROR</h4>
<pre>static final&nbsp;java.lang.String <a href="../../../../src-html/org/apache/wiki/variables/VariableManager.html#line.32">VAR_ERROR</a></pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../constant-values.html#org.apache.wiki.variables.VariableManager.VAR_ERROR">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="VAR_MSG">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>VAR_MSG</h4>
<pre>static final&nbsp;java.lang.String <a href="../../../../src-html/org/apache/wiki/variables/VariableManager.html#line.33">VAR_MSG</a></pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../constant-values.html#org.apache.wiki.variables.VariableManager.VAR_MSG">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a id="VAR_RUNFILTERS">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>VAR_RUNFILTERS</h4>
<pre>static final&nbsp;java.lang.String <a href="../../../../src-html/org/apache/wiki/variables/VariableManager.html#line.36">VAR_RUNFILTERS</a></pre>
<div class="block">If this variable is set to false, all filters are disabled when translating.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../constant-values.html#org.apache.wiki.variables.VariableManager.VAR_RUNFILTERS">Constant Field Values</a></dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="parseAndGetValue(org.apache.wiki.api.core.Context,java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>parseAndGetValue</h4>
<pre class="methodSignature">java.lang.String&nbsp;<a href="../../../../src-html/org/apache/wiki/variables/VariableManager.html#line.50">parseAndGetValue</a>&#8203;(<a href="../api/core/Context.html" title="interface in org.apache.wiki.api.core">Context</a>&nbsp;context,
java.lang.String&nbsp;link)
throws java.lang.IllegalArgumentException,
<a href="../api/exceptions/NoSuchVariableException.html" title="class in org.apache.wiki.api.exceptions">NoSuchVariableException</a></pre>
<div class="block">Parses the link and finds a value. This is essentially used once
<a href="../parser/LinkParsingOperations.html#isVariableLink(java.lang.String)"><code>LinkParsingOperations#isVariableLink(String)</code></a>
has found that the link text actually contains a variable. For example, you could pass in "{$username}" and get back
"JanneJalkanen".</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>context</code> - The WikiContext</dd>
<dd><code>link</code> - The link text containing the variable name.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The variable value.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - If the format is not valid (does not start with "{$", is zero length, etc.)</dd>
<dd><code><a href="../api/exceptions/NoSuchVariableException.html" title="class in org.apache.wiki.api.exceptions">NoSuchVariableException</a></code> - If a variable is not known.</dd>
</dl>
</li>
</ul>
<a id="expandVariables(org.apache.wiki.api.core.Context,java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>expandVariables</h4>
<pre class="methodSignature">java.lang.String&nbsp;<a href="../../../../src-html/org/apache/wiki/variables/VariableManager.html#line.62">expandVariables</a>&#8203;(<a href="../api/core/Context.html" title="interface in org.apache.wiki.api.core">Context</a>&nbsp;context,
java.lang.String&nbsp;source)</pre>
<div class="block">This method does in-place expansion of any variables. However, the expansion is not done twice, that is,
a variable containing text $variable will not be expanded.
<P>
The variables should be in the same format ({$variablename} as in the web pages.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>context</code> - The WikiContext of the current page.</dd>
<dd><code>source</code> - The source string.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The source string with variables expanded.</dd>
</dl>
</li>
</ul>
<a id="getValue(org.apache.wiki.api.core.Context,java.lang.String,java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getValue</h4>
<pre class="methodSignature">java.lang.String&nbsp;<a href="../../../../src-html/org/apache/wiki/variables/VariableManager.html#line.73">getValue</a>&#8203;(<a href="../api/core/Context.html" title="interface in org.apache.wiki.api.core">Context</a>&nbsp;context,
java.lang.String&nbsp;varName,
java.lang.String&nbsp;defValue)</pre>
<div class="block">Returns the value of a named variable. See <a href="#getValue(org.apache.wiki.api.core.Context,java.lang.String)"><code>getValue(Context, String)</code></a>. The only difference is that
this method does not throw an exception, but it returns the given default value instead.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>context</code> - WikiContext</dd>
<dd><code>varName</code> - The name of the variable</dd>
<dd><code>defValue</code> - A default value.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The variable value, or if not found, the default value.</dd>
</dl>
</li>
</ul>
<a id="getVariable(org.apache.wiki.api.core.Context,java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getVariable</h4>
<pre class="methodSignature">java.lang.String&nbsp;<a href="../../../../src-html/org/apache/wiki/variables/VariableManager.html#line.84">getVariable</a>&#8203;(<a href="../api/core/Context.html" title="interface in org.apache.wiki.api.core">Context</a>&nbsp;context,
java.lang.String&nbsp;name)</pre>
<div class="block">Shortcut to getValue(). However, this method does not throw a NoSuchVariableException, but returns null
in case the variable does not exist.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>context</code> - WikiContext to look the variable in</dd>
<dd><code>name</code> - Name of the variable to look for</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>Variable value, or null, if there is no such variable.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>2.2 on Engine, moved to VariableManager on 2.11.0</dd>
</dl>
</li>
</ul>
<a id="getValue(org.apache.wiki.api.core.Context,java.lang.String)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getValue</h4>
<pre class="methodSignature">java.lang.String&nbsp;<a href="../../../../src-html/org/apache/wiki/variables/VariableManager.html#line.110">getValue</a>&#8203;(<a href="../api/core/Context.html" title="interface in org.apache.wiki.api.core">Context</a>&nbsp;context,
java.lang.String&nbsp;varName)
throws java.lang.IllegalArgumentException,
<a href="../api/exceptions/NoSuchVariableException.html" title="class in org.apache.wiki.api.exceptions">NoSuchVariableException</a></pre>
<div class="block">Returns a value of the named variable. The resolving order is
<ol>
<li>Known "constant" name, such as "pagename", etc. This is so
that pages could not override certain constants.
<li>WikiContext local variable. This allows a programmer to
set a parameter which cannot be overridden by user.
<li>HTTP Session
<li>HTTP Request parameters
<li>WikiPage variable. As set by the user with the SET directive.
<li>jspwiki.properties
</ol>
Use this method only whenever you really need to have a parameter that
can be overridden by anyone using the wiki.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>context</code> - The WikiContext</dd>
<dd><code>varName</code> - Name of the variable.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The variable value.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - If the name is somehow broken.</dd>
<dd><code><a href="../api/exceptions/NoSuchVariableException.html" title="class in org.apache.wiki.api.exceptions">NoSuchVariableException</a></code> - If a variable is not known.</dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/VariableManager.html">Use</a></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>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses.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>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&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><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
<p class="legalCopy"><small>Copyright (c) 2001-2023 The Apache Software Foundation. All rights reserved.</small></p>
</footer>
</body>
</html>