|
| 1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| 2 | +<!-- NewPage --> |
| 3 | +<html lang="en"> |
| 4 | +<head> |
| 5 | +<!-- Generated by javadoc --> |
| 6 | +<title>ContextMultiBuilder (launchdarkly-java-server-sdk 7.10.2 API)</title> |
| 7 | +<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> |
| 8 | +<script type="text/javascript" src="../../../script.js"></script> |
| 9 | +</head> |
| 10 | +<body> |
| 11 | +<script type="text/javascript"><!-- |
| 12 | + try { |
| 13 | + if (location.href.indexOf('is-external=true') == -1) { |
| 14 | + parent.document.title="ContextMultiBuilder (launchdarkly-java-server-sdk 7.10.2 API)"; |
| 15 | + } |
| 16 | + } |
| 17 | + catch(err) { |
| 18 | + } |
| 19 | +//--> |
| 20 | +var methods = {"i0":10,"i1":10}; |
| 21 | +var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; |
| 22 | +var altColor = "altColor"; |
| 23 | +var rowColor = "rowColor"; |
| 24 | +var tableTab = "tableTab"; |
| 25 | +var activeTableTab = "activeTableTab"; |
| 26 | +</script> |
| 27 | +<noscript> |
| 28 | +<div>JavaScript is disabled on your browser.</div> |
| 29 | +</noscript> |
| 30 | +<!-- ========= START OF TOP NAVBAR ======= --> |
| 31 | +<div class="topNav"><a name="navbar.top"> |
| 32 | +<!-- --> |
| 33 | +</a> |
| 34 | +<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| 35 | +<a name="navbar.top.firstrow"> |
| 36 | +<!-- --> |
| 37 | +</a> |
| 38 | +<ul class="navList" title="Navigation"> |
| 39 | +<li><a href="../../../overview-summary.html">Overview</a></li> |
| 40 | +<li><a href="package-summary.html">Package</a></li> |
| 41 | +<li class="navBarCell1Rev">Class</li> |
| 42 | +<li><a href="package-tree.html">Tree</a></li> |
| 43 | +<li><a href="../../../deprecated-list.html">Deprecated</a></li> |
| 44 | +<li><a href="../../../index-all.html">Index</a></li> |
| 45 | +<li><a href="../../../help-doc.html">Help</a></li> |
| 46 | +</ul> |
| 47 | +</div> |
| 48 | +<div class="subNav"> |
| 49 | +<ul class="navList"> |
| 50 | +<li><a href="../../../com/launchdarkly/sdk/ContextKind.html" title="class in com.launchdarkly.sdk"><span class="typeNameLink">Prev Class</span></a></li> |
| 51 | +<li><a href="../../../com/launchdarkly/sdk/EvaluationDetail.html" title="class in com.launchdarkly.sdk"><span class="typeNameLink">Next Class</span></a></li> |
| 52 | +</ul> |
| 53 | +<ul class="navList"> |
| 54 | +<li><a href="../../../index.html?com/launchdarkly/sdk/ContextMultiBuilder.html" target="_top">Frames</a></li> |
| 55 | +<li><a href="ContextMultiBuilder.html" target="_top">No Frames</a></li> |
| 56 | +</ul> |
| 57 | +<ul class="navList" id="allclasses_navbar_top"> |
| 58 | +<li><a href="../../../allclasses-noframe.html">All Classes</a></li> |
| 59 | +</ul> |
| 60 | +<div> |
| 61 | +<script type="text/javascript"><!-- |
| 62 | + allClassesLink = document.getElementById("allclasses_navbar_top"); |
| 63 | + if(window==top) { |
| 64 | + allClassesLink.style.display = "block"; |
| 65 | + } |
| 66 | + else { |
| 67 | + allClassesLink.style.display = "none"; |
| 68 | + } |
| 69 | + //--> |
| 70 | +</script> |
| 71 | +</div> |
| 72 | +<div> |
| 73 | +<ul class="subNavList"> |
| 74 | +<li>Summary: </li> |
| 75 | +<li>Nested | </li> |
| 76 | +<li>Field | </li> |
| 77 | +<li>Constr | </li> |
| 78 | +<li><a href="#method.summary">Method</a></li> |
| 79 | +</ul> |
| 80 | +<ul class="subNavList"> |
| 81 | +<li>Detail: </li> |
| 82 | +<li>Field | </li> |
| 83 | +<li>Constr | </li> |
| 84 | +<li><a href="#method.detail">Method</a></li> |
| 85 | +</ul> |
| 86 | +</div> |
| 87 | +<a name="skip.navbar.top"> |
| 88 | +<!-- --> |
| 89 | +</a></div> |
| 90 | +<!-- ========= END OF TOP NAVBAR ========= --> |
| 91 | +<!-- ======== START OF CLASS DATA ======== --> |
| 92 | +<div class="header"> |
| 93 | +<div class="subTitle">com.launchdarkly.sdk</div> |
| 94 | +<h2 title="Class ContextMultiBuilder" class="title">Class ContextMultiBuilder</h2> |
| 95 | +</div> |
| 96 | +<div class="contentContainer"> |
| 97 | +<ul class="inheritance"> |
| 98 | +<li>java.lang.Object</li> |
| 99 | +<li> |
| 100 | +<ul class="inheritance"> |
| 101 | +<li>com.launchdarkly.sdk.ContextMultiBuilder</li> |
| 102 | +</ul> |
| 103 | +</li> |
| 104 | +</ul> |
| 105 | +<div class="description"> |
| 106 | +<ul class="blockList"> |
| 107 | +<li class="blockList"> |
| 108 | +<hr> |
| 109 | +<br> |
| 110 | +<pre>public final class <span class="typeNameLabel">ContextMultiBuilder</span> |
| 111 | +extends java.lang.Object</pre> |
| 112 | +<div class="block">A mutable object that uses the builder pattern to specify properties for a multi-kind |
| 113 | + <a href="../../../com/launchdarkly/sdk/LDContext.html" title="class in com.launchdarkly.sdk"><code>LDContext</code></a>. |
| 114 | + <p> |
| 115 | + Use this builder if you need to construct a context that has multiple <a href="../../../com/launchdarkly/sdk/ContextKind.html" title="class in com.launchdarkly.sdk"><code>ContextKind</code></a> |
| 116 | + values, each with its own corresponding LDContext. To define a single-kind context, |
| 117 | + use <a href="../../../com/launchdarkly/sdk/LDContext.html#builder-java.lang.String-"><code>LDContext.builder(String)</code></a> or any of the single-kind factory methods |
| 118 | + in <a href="../../../com/launchdarkly/sdk/LDContext.html" title="class in com.launchdarkly.sdk"><code>LDContext</code></a>. |
| 119 | + <p> |
| 120 | + Obtain an instance of ContextMultiBuilder by calling <a href="../../../com/launchdarkly/sdk/LDContext.html#multiBuilder--"><code>LDContext.multiBuilder()</code></a>; |
| 121 | + then, call <a href="../../../com/launchdarkly/sdk/ContextMultiBuilder.html#add-com.launchdarkly.sdk.LDContext-"><code>add(LDContext)</code></a> to specify the individual context for each kind. The |
| 122 | + <a href="../../../com/launchdarkly/sdk/ContextMultiBuilder.html#add-com.launchdarkly.sdk.LDContext-"><code>add(LDContext)</code></a> method returns a reference to the same builder, so calls can be |
| 123 | + chained: |
| 124 | + <pre><code> |
| 125 | + LDContext context = LDContext.multiBuilder() |
| 126 | + .add(LDContext.create("context-key-123abc")) |
| 127 | + .add(LDContext.create(ContextKind.of("organization"), "my-org-key")) |
| 128 | + .build(); |
| 129 | + </code></pre> |
| 130 | + <p> |
| 131 | + A ContextMultiBuilder should not be accessed by multiple threads at once. Once you have |
| 132 | + called <a href="../../../com/launchdarkly/sdk/ContextMultiBuilder.html#build--"><code>build()</code></a>, the resulting LDContext is immutable and is safe to use from |
| 133 | + multiple threads. Instances created with <a href="../../../com/launchdarkly/sdk/ContextMultiBuilder.html#build--"><code>build()</code></a> are not affected by subsequent |
| 134 | + actions taken on the builder.</div> |
| 135 | +<dl> |
| 136 | +<dt><span class="seeLabel">See Also:</span></dt> |
| 137 | +<dd><a href="../../../com/launchdarkly/sdk/LDContext.html#createMulti-com.launchdarkly.sdk.LDContext...-"><code>LDContext.createMulti(LDContext...)</code></a></dd> |
| 138 | +</dl> |
| 139 | +</li> |
| 140 | +</ul> |
| 141 | +</div> |
| 142 | +<div class="summary"> |
| 143 | +<ul class="blockList"> |
| 144 | +<li class="blockList"> |
| 145 | +<!-- ========== METHOD SUMMARY =========== --> |
| 146 | +<ul class="blockList"> |
| 147 | +<li class="blockList"><a name="method.summary"> |
| 148 | +<!-- --> |
| 149 | +</a> |
| 150 | +<h3>Method Summary</h3> |
| 151 | +<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| 152 | +<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> |
| 153 | +<tr> |
| 154 | +<th class="colFirst" scope="col">Modifier and Type</th> |
| 155 | +<th class="colLast" scope="col">Method and Description</th> |
| 156 | +</tr> |
| 157 | +<tr id="i0" class="altColor"> |
| 158 | +<td class="colFirst"><code><a href="../../../com/launchdarkly/sdk/ContextMultiBuilder.html" title="class in com.launchdarkly.sdk">ContextMultiBuilder</a></code></td> |
| 159 | +<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/launchdarkly/sdk/ContextMultiBuilder.html#add-com.launchdarkly.sdk.LDContext-">add</a></span>(<a href="../../../com/launchdarkly/sdk/LDContext.html" title="class in com.launchdarkly.sdk">LDContext</a> context)</code> |
| 160 | +<div class="block">Adds an individual LDContext for a specific kind to the builer.</div> |
| 161 | +</td> |
| 162 | +</tr> |
| 163 | +<tr id="i1" class="rowColor"> |
| 164 | +<td class="colFirst"><code><a href="../../../com/launchdarkly/sdk/LDContext.html" title="class in com.launchdarkly.sdk">LDContext</a></code></td> |
| 165 | +<td class="colLast"><code><span class="memberNameLink"><a href="../../../com/launchdarkly/sdk/ContextMultiBuilder.html#build--">build</a></span>()</code> |
| 166 | +<div class="block">Creates an <a href="../../../com/launchdarkly/sdk/LDContext.html" title="class in com.launchdarkly.sdk"><code>LDContext</code></a> from the current builder properties.</div> |
| 167 | +</td> |
| 168 | +</tr> |
| 169 | +</table> |
| 170 | +<ul class="blockList"> |
| 171 | +<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> |
| 172 | +<!-- --> |
| 173 | +</a> |
| 174 | +<h3>Methods inherited from class java.lang.Object</h3> |
| 175 | +<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> |
| 176 | +</ul> |
| 177 | +</li> |
| 178 | +</ul> |
| 179 | +</li> |
| 180 | +</ul> |
| 181 | +</div> |
| 182 | +<div class="details"> |
| 183 | +<ul class="blockList"> |
| 184 | +<li class="blockList"> |
| 185 | +<!-- ============ METHOD DETAIL ========== --> |
| 186 | +<ul class="blockList"> |
| 187 | +<li class="blockList"><a name="method.detail"> |
| 188 | +<!-- --> |
| 189 | +</a> |
| 190 | +<h3>Method Detail</h3> |
| 191 | +<a name="build--"> |
| 192 | +<!-- --> |
| 193 | +</a> |
| 194 | +<ul class="blockList"> |
| 195 | +<li class="blockList"> |
| 196 | +<h4>build</h4> |
| 197 | +<pre>public <a href="../../../com/launchdarkly/sdk/LDContext.html" title="class in com.launchdarkly.sdk">LDContext</a> build()</pre> |
| 198 | +<div class="block">Creates an <a href="../../../com/launchdarkly/sdk/LDContext.html" title="class in com.launchdarkly.sdk"><code>LDContext</code></a> from the current builder properties. |
| 199 | + <p> |
| 200 | + The LDContext is immutable and will not be affected by any subsequent actions on the |
| 201 | + builder. |
| 202 | + <p> |
| 203 | + It is possible for a ContextMultiBuilder to represent an invalid state. Instead of |
| 204 | + throwing an exception, the ContextMultiBuilder always returns an LDContext, and you |
| 205 | + can check <a href="../../../com/launchdarkly/sdk/LDContext.html#isValid--"><code>LDContext.isValid()</code></a> or <a href="../../../com/launchdarkly/sdk/LDContext.html#getError--"><code>LDContext.getError()</code></a> to see if it |
| 206 | + has an error. See <a href="../../../com/launchdarkly/sdk/LDContext.html#isValid--"><code>LDContext.isValid()</code></a> for more information about invalid |
| 207 | + context conditions. If you pass an invalid context to an SDK method, the SDK will |
| 208 | + detect this and will log a description of the error. |
| 209 | + <p> |
| 210 | + If only one context kind was added to the builder, this method returns a single-kind |
| 211 | + LDContext rather than a multi-kind one.</div> |
| 212 | +<dl> |
| 213 | +<dt><span class="returnLabel">Returns:</span></dt> |
| 214 | +<dd>a new <a href="../../../com/launchdarkly/sdk/LDContext.html" title="class in com.launchdarkly.sdk"><code>LDContext</code></a></dd> |
| 215 | +</dl> |
| 216 | +</li> |
| 217 | +</ul> |
| 218 | +<a name="add-com.launchdarkly.sdk.LDContext-"> |
| 219 | +<!-- --> |
| 220 | +</a> |
| 221 | +<ul class="blockListLast"> |
| 222 | +<li class="blockList"> |
| 223 | +<h4>add</h4> |
| 224 | +<pre>public <a href="../../../com/launchdarkly/sdk/ContextMultiBuilder.html" title="class in com.launchdarkly.sdk">ContextMultiBuilder</a> add(<a href="../../../com/launchdarkly/sdk/LDContext.html" title="class in com.launchdarkly.sdk">LDContext</a> context)</pre> |
| 225 | +<div class="block">Adds an individual LDContext for a specific kind to the builer. |
| 226 | + <p> |
| 227 | + It is invalid to add more than one LDContext for the same kind, or to add an LDContext |
| 228 | + that is itself invalid. This error is detected when you call <a href="../../../com/launchdarkly/sdk/ContextMultiBuilder.html#build--"><code>build()</code></a>. |
| 229 | + <p> |
| 230 | + If the nested context is multi-kind, this is exactly equivalent to adding each of the |
| 231 | + individual kinds from it separately. For instance, in the following example, "multi1" and |
| 232 | + "multi2" end up being exactly the same: |
| 233 | + <pre><code> |
| 234 | + LDContext c1 = LDContext.create(ContextKind.of("kind1"), "key1"); |
| 235 | + LDContext c2 = LDContext.create(ContextKind.of("kind2"), "key2"); |
| 236 | + LDContext c3 = LDContext.create(ContextKind.of("kind3"), "key3"); |
| 237 | + |
| 238 | + LDContext multi1 = LDContext.multiBuilder().add(c1).add(c2).add(c3).build(); |
| 239 | + |
| 240 | + LDContext c1plus2 = LDContext.multiBuilder().add(c1).add(c2).build(); |
| 241 | + LDContext multi2 = LDContext.multiBuilder().add(c1plus2).add(c3).build(); |
| 242 | + </code></pre></div> |
| 243 | +<dl> |
| 244 | +<dt><span class="paramLabel">Parameters:</span></dt> |
| 245 | +<dd><code>context</code> - the context to add</dd> |
| 246 | +<dt><span class="returnLabel">Returns:</span></dt> |
| 247 | +<dd>the builder</dd> |
| 248 | +</dl> |
| 249 | +</li> |
| 250 | +</ul> |
| 251 | +</li> |
| 252 | +</ul> |
| 253 | +</li> |
| 254 | +</ul> |
| 255 | +</div> |
| 256 | +</div> |
| 257 | +<!-- ========= END OF CLASS DATA ========= --> |
| 258 | +<!-- ======= START OF BOTTOM NAVBAR ====== --> |
| 259 | +<div class="bottomNav"><a name="navbar.bottom"> |
| 260 | +<!-- --> |
| 261 | +</a> |
| 262 | +<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| 263 | +<a name="navbar.bottom.firstrow"> |
| 264 | +<!-- --> |
| 265 | +</a> |
| 266 | +<ul class="navList" title="Navigation"> |
| 267 | +<li><a href="../../../overview-summary.html">Overview</a></li> |
| 268 | +<li><a href="package-summary.html">Package</a></li> |
| 269 | +<li class="navBarCell1Rev">Class</li> |
| 270 | +<li><a href="package-tree.html">Tree</a></li> |
| 271 | +<li><a href="../../../deprecated-list.html">Deprecated</a></li> |
| 272 | +<li><a href="../../../index-all.html">Index</a></li> |
| 273 | +<li><a href="../../../help-doc.html">Help</a></li> |
| 274 | +</ul> |
| 275 | +</div> |
| 276 | +<div class="subNav"> |
| 277 | +<ul class="navList"> |
| 278 | +<li><a href="../../../com/launchdarkly/sdk/ContextKind.html" title="class in com.launchdarkly.sdk"><span class="typeNameLink">Prev Class</span></a></li> |
| 279 | +<li><a href="../../../com/launchdarkly/sdk/EvaluationDetail.html" title="class in com.launchdarkly.sdk"><span class="typeNameLink">Next Class</span></a></li> |
| 280 | +</ul> |
| 281 | +<ul class="navList"> |
| 282 | +<li><a href="../../../index.html?com/launchdarkly/sdk/ContextMultiBuilder.html" target="_top">Frames</a></li> |
| 283 | +<li><a href="ContextMultiBuilder.html" target="_top">No Frames</a></li> |
| 284 | +</ul> |
| 285 | +<ul class="navList" id="allclasses_navbar_bottom"> |
| 286 | +<li><a href="../../../allclasses-noframe.html">All Classes</a></li> |
| 287 | +</ul> |
| 288 | +<div> |
| 289 | +<script type="text/javascript"><!-- |
| 290 | + allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| 291 | + if(window==top) { |
| 292 | + allClassesLink.style.display = "block"; |
| 293 | + } |
| 294 | + else { |
| 295 | + allClassesLink.style.display = "none"; |
| 296 | + } |
| 297 | + //--> |
| 298 | +</script> |
| 299 | +</div> |
| 300 | +<div> |
| 301 | +<ul class="subNavList"> |
| 302 | +<li>Summary: </li> |
| 303 | +<li>Nested | </li> |
| 304 | +<li>Field | </li> |
| 305 | +<li>Constr | </li> |
| 306 | +<li><a href="#method.summary">Method</a></li> |
| 307 | +</ul> |
| 308 | +<ul class="subNavList"> |
| 309 | +<li>Detail: </li> |
| 310 | +<li>Field | </li> |
| 311 | +<li>Constr | </li> |
| 312 | +<li><a href="#method.detail">Method</a></li> |
| 313 | +</ul> |
| 314 | +</div> |
| 315 | +<a name="skip.navbar.bottom"> |
| 316 | +<!-- --> |
| 317 | +</a></div> |
| 318 | +<!-- ======== END OF BOTTOM NAVBAR ======= --> |
| 319 | +</body> |
| 320 | +</html> |
0 commit comments