blob: c30ecb01f4c82abfec3d2c4f690c19ca7f23fd00 [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>
<title>JsonPointer</title>
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../script.js"></script>
<link rel="shortcut icon" href="/img/jakarta-favicon.ico">
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="JsonPointer";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":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>
<div class="subNav">
<ul class="navList">
<li><a href="../../jakarta/json/JsonPatchBuilder.html" title="interface in jakarta.json"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../jakarta/json/JsonReader.html" title="interface in jakarta.json"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?jakarta/json/JsonPointer.html" target="_top">Frames</a></li>
<li><a href="JsonPointer.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">jakarta.json</div>
<h2 title="Interface JsonPointer" class="title">Interface JsonPointer</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public interface <span class="typeNameLabel">JsonPointer</span></pre>
<div class="block"><p>This interface represents an immutable implementation of a JSON Pointer
as defined by <a href="http://tools.ietf.org/html/rfc6901">RFC 6901</a>.
</p>
<p> A JSON Pointer, when applied to a target <a href="../../jakarta/json/JsonValue.html" title="interface in jakarta.json"><code>JsonValue</code></a>,
defines a reference location in the target.</p>
<p> An empty JSON Pointer string defines a reference to the target itself.</p>
<p> If the JSON Pointer string is non-empty, it must be a sequence
of '/' prefixed tokens, and the target must either be a <a href="../../jakarta/json/JsonArray.html" title="interface in jakarta.json"><code>JsonArray</code></a>
or <a href="../../jakarta/json/JsonObject.html" title="interface in jakarta.json"><code>JsonObject</code></a>. If the target is a <code>JsonArray</code>, the pointer
defines a reference to an array element, and the last token specifies the index.
If the target is a <a href="../../jakarta/json/JsonObject.html" title="interface in jakarta.json"><code>JsonObject</code></a>, the pointer defines a reference to a
name/value pair, and the last token specifies the name.
</p>
<p> The method <a href="../../jakarta/json/JsonPointer.html#getValue-jakarta.json.JsonStructure-"><code>getValue()</code></a> returns the referenced value.
Methods <a href="../../jakarta/json/JsonPointer.html#add-T-jakarta.json.JsonValue-"><code>add()</code></a>, <a href="../../jakarta/json/JsonPointer.html#replace-T-jakarta.json.JsonValue-"><code>replace()</code></a>,
and <a href="../../jakarta/json/JsonPointer.html#remove-T-"><code>remove()</code></a> execute operations specified in
<a href="http://tools.ietf.org/html/rfc6902">RFC 6902</a>. </p></div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.1</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="http://tools.ietf.org/html/rfc6901">RFC 6901</a>,
<a href="http://tools.ietf.org/html/rfc6902">RFC 6902</a></dd>
</dl>
</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>&lt;T extends <a href="../../jakarta/json/JsonStructure.html" title="interface in jakarta.json">JsonStructure</a>&gt;<br>T</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/json/JsonPointer.html#add-T-jakarta.json.JsonValue-">add</a></span>(T&nbsp;target,
<a href="../../jakarta/json/JsonValue.html" title="interface in jakarta.json">JsonValue</a>&nbsp;value)</code>
<div class="block">Adds or replaces a value at the referenced location in the specified
<code>target</code> with the specified <code>value</code>.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/json/JsonPointer.html#containsValue-jakarta.json.JsonStructure-">containsValue</a></span>(<a href="../../jakarta/json/JsonStructure.html" title="interface in jakarta.json">JsonStructure</a>&nbsp;target)</code>
<div class="block">Returns <code>true</code> if there is a value at the referenced location in the specified <code>target</code>.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code><a href="../../jakarta/json/JsonValue.html" title="interface in jakarta.json">JsonValue</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/json/JsonPointer.html#getValue-jakarta.json.JsonStructure-">getValue</a></span>(<a href="../../jakarta/json/JsonStructure.html" title="interface in jakarta.json">JsonStructure</a>&nbsp;target)</code>
<div class="block">Returns the value at the referenced location in the specified <code>target</code>.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>&lt;T extends <a href="../../jakarta/json/JsonStructure.html" title="interface in jakarta.json">JsonStructure</a>&gt;<br>T</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/json/JsonPointer.html#remove-T-">remove</a></span>(T&nbsp;target)</code>
<div class="block">Removes the value at the reference location in the specified <code>target</code>.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>&lt;T extends <a href="../../jakarta/json/JsonStructure.html" title="interface in jakarta.json">JsonStructure</a>&gt;<br>T</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/json/JsonPointer.html#replace-T-jakarta.json.JsonValue-">replace</a></span>(T&nbsp;target,
<a href="../../jakarta/json/JsonValue.html" title="interface in jakarta.json">JsonValue</a>&nbsp;value)</code>
<div class="block">Replaces the value at the referenced location in the specified
<code>target</code> with the specified <code>value</code>.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../jakarta/json/JsonPointer.html#toString--">toString</a></span>()</code>
<div class="block">Returns the string representation of this JSON Pointer.</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="add-jakarta.json.JsonStructure-jakarta.json.JsonValue-">
<!-- -->
</a><a name="add-T-jakarta.json.JsonValue-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>add</h4>
<pre>&lt;T extends <a href="../../jakarta/json/JsonStructure.html" title="interface in jakarta.json">JsonStructure</a>&gt;&nbsp;T&nbsp;add(T&nbsp;target,
<a href="../../jakarta/json/JsonValue.html" title="interface in jakarta.json">JsonValue</a>&nbsp;value)</pre>
<div class="block">Adds or replaces a value at the referenced location in the specified
<code>target</code> with the specified <code>value</code>.
<ol>
<li>If the reference is the target (empty JSON Pointer string),
the specified <code>value</code>, which must be the same type as
specified <code>target</code>, is returned.</li>
<li>If the reference is an array element, the specified <code>value</code> is inserted
into the array, at the referenced index. The value currently at that location, and
any subsequent values, are shifted to the right (adds one to the indices).
Index starts with 0. If the reference is specified with a "-", or if the
index is equal to the size of the array, the value is appended to the array.</li>
<li>If the reference is a name/value pair of a <code>JsonObject</code>, and the
referenced value exists, the value is replaced by the specified <code>value</code>.
If the value does not exist, a new name/value pair is added to the object.</li>
</ol></div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - the target type, must be a subtype of <a href="../../jakarta/json/JsonValue.html" title="interface in jakarta.json"><code>JsonValue</code></a></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>target</code> - the target referenced by this <code>JsonPointer</code></dd>
<dd><code>value</code> - the value to be added</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the transformed <code>target</code> after the value is added.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.NullPointerException</code> - if <code>target</code> is <code>null</code></dd>
<dd><code><a href="../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if the reference is an array element and
the index is out of range (<code>index &lt; 0 || index &gt; array size</code>),
or if the pointer contains references to non-existing objects or arrays.</dd>
</dl>
</li>
</ul>
<a name="remove-jakarta.json.JsonStructure-">
<!-- -->
</a><a name="remove-T-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>remove</h4>
<pre>&lt;T extends <a href="../../jakarta/json/JsonStructure.html" title="interface in jakarta.json">JsonStructure</a>&gt;&nbsp;T&nbsp;remove(T&nbsp;target)</pre>
<div class="block">Removes the value at the reference location in the specified <code>target</code>.</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - the target type, must be a subtype of <a href="../../jakarta/json/JsonValue.html" title="interface in jakarta.json"><code>JsonValue</code></a></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>target</code> - the target referenced by this <code>JsonPointer</code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the transformed <code>target</code> after the value is removed.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.NullPointerException</code> - if <code>target</code> is <code>null</code></dd>
<dd><code><a href="../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if the referenced value does not exist,
or if the reference is the target.</dd>
</dl>
</li>
</ul>
<a name="replace-jakarta.json.JsonStructure-jakarta.json.JsonValue-">
<!-- -->
</a><a name="replace-T-jakarta.json.JsonValue-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>replace</h4>
<pre>&lt;T extends <a href="../../jakarta/json/JsonStructure.html" title="interface in jakarta.json">JsonStructure</a>&gt;&nbsp;T&nbsp;replace(T&nbsp;target,
<a href="../../jakarta/json/JsonValue.html" title="interface in jakarta.json">JsonValue</a>&nbsp;value)</pre>
<div class="block">Replaces the value at the referenced location in the specified
<code>target</code> with the specified <code>value</code>.</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - the target type, must be a subtype of <a href="../../jakarta/json/JsonValue.html" title="interface in jakarta.json"><code>JsonValue</code></a></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>target</code> - the target referenced by this <code>JsonPointer</code></dd>
<dd><code>value</code> - the value to be stored at the referenced location</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the transformed <code>target</code> after the value is replaced.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.NullPointerException</code> - if <code>target</code> is <code>null</code></dd>
<dd><code><a href="../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if the referenced value does not exist,
or if the reference is the target.</dd>
</dl>
</li>
</ul>
<a name="containsValue-jakarta.json.JsonStructure-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>containsValue</h4>
<pre>boolean&nbsp;containsValue(<a href="../../jakarta/json/JsonStructure.html" title="interface in jakarta.json">JsonStructure</a>&nbsp;target)</pre>
<div class="block">Returns <code>true</code> if there is a value at the referenced location in the specified <code>target</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>target</code> - the target referenced by this <code>JsonPointer</code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if this pointer points to a value in a specified <code>target</code>.</dd>
</dl>
</li>
</ul>
<a name="getValue-jakarta.json.JsonStructure-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getValue</h4>
<pre><a href="../../jakarta/json/JsonValue.html" title="interface in jakarta.json">JsonValue</a>&nbsp;getValue(<a href="../../jakarta/json/JsonStructure.html" title="interface in jakarta.json">JsonStructure</a>&nbsp;target)</pre>
<div class="block">Returns the value at the referenced location in the specified <code>target</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>target</code> - the target referenced by this <code>JsonPointer</code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the referenced value in the target.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.NullPointerException</code> - if <code>target</code> is null</dd>
<dd><code><a href="../../jakarta/json/JsonException.html" title="class in jakarta.json">JsonException</a></code> - if the referenced value does not exist</dd>
</dl>
</li>
</ul>
<a name="toString--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>toString</h4>
<pre>java.lang.String&nbsp;toString()</pre>
<div class="block">Returns the string representation of this JSON Pointer.
The value to be returned is an empty string or a sequence of '<code>/</code>' prefixed tokens.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code>toString</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the valid escaped JSON Pointer string.</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>
<div class="subNav">
<ul class="navList">
<li><a href="../../jakarta/json/JsonPatchBuilder.html" title="interface in jakarta.json"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../jakarta/json/JsonReader.html" title="interface in jakarta.json"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?jakarta/json/JsonPointer.html" target="_top">Frames</a></li>
<li><a href="JsonPointer.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 ======= -->
</body>
</html>