|
| 1 | +<!DOCTYPE HTML> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | +<!-- Generated by javadoc (17) --> |
| 5 | +<title>MemoizeContextParameter (Arez API Documentation)</title> |
| 6 | +<meta name="viewport" content="width=device-width, initial-scale=1"> |
| 7 | +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 8 | +<meta name="description" content="declaration: package: arez.annotations, annotation type: MemoizeContextParameter"> |
| 9 | +<meta name="generator" content="javadoc/ClassWriterImpl"> |
| 10 | +<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style"> |
| 11 | +<link rel="stylesheet" type="text/css" href="../../script-dir/jquery-ui.min.css" title="Style"> |
| 12 | +<link rel="stylesheet" type="text/css" href="../../jquery-ui.overrides.css" title="Style"> |
| 13 | +<script type="text/javascript" src="../../script.js"></script> |
| 14 | +<script type="text/javascript" src="../../script-dir/jquery-3.5.1.min.js"></script> |
| 15 | +<script type="text/javascript" src="../../script-dir/jquery-ui.min.js"></script> |
| 16 | +</head> |
| 17 | +<body class="class-declaration-page"> |
| 18 | +<script type="text/javascript">var pathtoroot = "../../"; |
| 19 | +loadScripts(document, 'script');</script> |
| 20 | +<noscript> |
| 21 | +<div>JavaScript is disabled on your browser.</div> |
| 22 | +</noscript> |
| 23 | +<div class="flex-box"> |
| 24 | +<header role="banner" class="flex-header"> |
| 25 | +<nav role="navigation"> |
| 26 | +<!-- ========= START OF TOP NAVBAR ======= --> |
| 27 | +<div class="top-nav" id="navbar-top"> |
| 28 | +<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div> |
| 29 | +<ul id="navbar-top-firstrow" class="nav-list" title="Navigation"> |
| 30 | +<li><a href="../../index.html">Overview</a></li> |
| 31 | +<li><a href="package-summary.html">Package</a></li> |
| 32 | +<li class="nav-bar-cell1-rev">Class</li> |
| 33 | +<li><a href="package-tree.html">Tree</a></li> |
| 34 | +<li><a href="../../index-all.html">Index</a></li> |
| 35 | +<li><a href="../../help-doc.html#class">Help</a></li> |
| 36 | +</ul> |
| 37 | +</div> |
| 38 | +<div class="sub-nav"> |
| 39 | +<div> |
| 40 | +<ul class="sub-nav-list"> |
| 41 | +<li>Summary: </li> |
| 42 | +<li>Field | </li> |
| 43 | +<li><a href="#annotation-interface-optional-element-summary">Optional</a> | </li> |
| 44 | +<li>Required</li> |
| 45 | +</ul> |
| 46 | +<ul class="sub-nav-list"> |
| 47 | +<li>Detail: </li> |
| 48 | +<li>Field | </li> |
| 49 | +<li><a href="#annotation-interface-element-detail">Element</a></li> |
| 50 | +</ul> |
| 51 | +</div> |
| 52 | +<div class="nav-list-search"><label for="search-input">SEARCH:</label> |
| 53 | +<input type="text" id="search-input" value="search" disabled="disabled"> |
| 54 | +<input type="reset" id="reset-button" value="reset" disabled="disabled"> |
| 55 | +</div> |
| 56 | +</div> |
| 57 | +<!-- ========= END OF TOP NAVBAR ========= --> |
| 58 | +<span class="skip-nav" id="skip-navbar-top"></span></nav> |
| 59 | +</header> |
| 60 | +<div class="flex-content"> |
| 61 | +<main role="main"> |
| 62 | +<!-- ======== START OF CLASS DATA ======== --> |
| 63 | +<div class="header"> |
| 64 | +<div class="sub-title"><span class="package-label-in-type">Package</span> <a href="package-summary.html">arez.annotations</a></div> |
| 65 | +<h1 title="Annotation Interface MemoizeContextParameter" class="title">Annotation Interface MemoizeContextParameter</h1> |
| 66 | +</div> |
| 67 | +<section class="class-description" id="class-description"> |
| 68 | +<hr> |
| 69 | +<div class="type-signature"><span class="annotations"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/annotation/Documented.html" title="class or interface in java.lang.annotation" class="external-link">@Documented</a> |
| 70 | +<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/annotation/Target.html" title="class or interface in java.lang.annotation" class="external-link">@Target</a>(<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/annotation/ElementType.html#METHOD" title="class or interface in java.lang.annotation" class="external-link">METHOD</a>) |
| 71 | +</span><span class="modifiers">public @interface </span><span class="element-name"><a href="../../src-html/arez/annotations/MemoizeContextParameter.html#line-82">MemoizeContextParameter</a></span></div> |
| 72 | +<div class="block">Annotation applied to methods that define a single "contextual" parameter to one or more <a href="Memoize.html" title="annotation interface in arez.annotations"><code>Memoize</code></a> |
| 73 | + annotated methods. A "contextual" parameter is one that is used within the <a href="Memoize.html" title="annotation interface in arez.annotations"><code>Memoize</code></a> annotated methods, |
| 74 | + but is not passed in but derived from the calling context. These are the conceptual equivalent of thread-local |
| 75 | + values accessed from within the function. |
| 76 | + |
| 77 | + <p>There are expected to be a three methods for each context parameter: one to get the value from the |
| 78 | + calling context (optionally prefixed with "capture" that returns the type of the context parameter), one |
| 79 | + to push the value to the calling context (prefixed with "push" with a single parameter that has the |
| 80 | + type of the context parameter), and one to pop the value from the calling context (prefixed with "pop" |
| 81 | + with a single parameter that has the type of the context parameter).</p> |
| 82 | + |
| 83 | + <h2>Capture Method</h2> |
| 84 | + |
| 85 | + <p>The method to capture the context parameter is invoked prior to the invocation of the <a href="Memoize.html" title="annotation interface in arez.annotations"><code>Memoize</code></a> |
| 86 | + annotated method when non-arez-framework code invokes the method. It may be invoked outside of an arez |
| 87 | + transaction if the associated method has <a href="Memoize.html#readOutsideTransaction()"><code>Memoize.readOutsideTransaction()</code></a> resolve to |
| 88 | + <a href="Feature.html#DISABLE"><code>Feature.DISABLE</code></a>. The method must also comply with the following additional constraints:</p> |
| 89 | + |
| 90 | + <ul> |
| 91 | + <li>Must not be annotated with any other arez annotation</li> |
| 92 | + <li>Must return a value</li> |
| 93 | + <li>Must not have any parameters</li> |
| 94 | + <li>Must not specify type parameters</li> |
| 95 | + <li>Must not be private</li> |
| 96 | + <li>Must not be static</li> |
| 97 | + <li>Must not be abstract</li> |
| 98 | + <li>Must not throw exceptions</li> |
| 99 | + <li>Must be accessible to the class annotated by the <a href="ArezComponent.html" title="annotation interface in arez.annotations"><code>ArezComponent</code></a> annotation.</li> |
| 100 | + </ul> |
| 101 | + |
| 102 | + <h2>Push Method</h2> |
| 103 | + |
| 104 | + <p>The method to push the context parameter into the current context is invoked prior to the invocation |
| 105 | + of the <a href="Memoize.html" title="annotation interface in arez.annotations"><code>Memoize</code></a> annotated method when the arez framework invokes the method to determine whether |
| 106 | + the result has changed. It is invoked outside of an arez transaction. The method must also comply |
| 107 | + with the following additional constraints:</p> |
| 108 | + |
| 109 | + <p>The method that is annotated with this annotation must comply with the additional constraints:</p> |
| 110 | + <ul> |
| 111 | + <li>The method name must start with "push"</li> |
| 112 | + <li>Must not be annotated with any other arez annotation</li> |
| 113 | + <li>Must not return a value</li> |
| 114 | + <li>Must have one parameter</li> |
| 115 | + <li>Must not specify type parameters</li> |
| 116 | + <li>Must not be private</li> |
| 117 | + <li>Must not be static</li> |
| 118 | + <li>Must not be abstract</li> |
| 119 | + <li>Must not throw exceptions</li> |
| 120 | + <li>Must be accessible to the class annotated by the <a href="ArezComponent.html" title="annotation interface in arez.annotations"><code>ArezComponent</code></a> annotation.</li> |
| 121 | + </ul> |
| 122 | + |
| 123 | + <h2>Pop Method</h2> |
| 124 | + |
| 125 | + <p>The method to pop the context parameter from the current context is invoked after to the invocation |
| 126 | + of the <a href="Memoize.html" title="annotation interface in arez.annotations"><code>Memoize</code></a> annotated method when the arez framework invokes the method to determine whether |
| 127 | + the result has changed. It is invoked outside of an arez transaction. The method must also comply |
| 128 | + with the following additional constraints:</p> |
| 129 | + |
| 130 | + <p>The method that is annotated with this annotation must comply with the additional constraints:</p> |
| 131 | + <ul> |
| 132 | + <li>The method name must start with "pop"</li> |
| 133 | + <li>Must not be annotated with any other arez annotation</li> |
| 134 | + <li>Must not return a value</li> |
| 135 | + <li>Must have one parameter</li> |
| 136 | + <li>Must not specify type parameters</li> |
| 137 | + <li>Must not be private</li> |
| 138 | + <li>Must not be static</li> |
| 139 | + <li>Must not be abstract</li> |
| 140 | + <li>Must not throw exceptions</li> |
| 141 | + <li>Must be accessible to the class annotated by the <a href="ArezComponent.html" title="annotation interface in arez.annotations"><code>ArezComponent</code></a> annotation.</li> |
| 142 | + </ul></div> |
| 143 | +</section> |
| 144 | +<section class="summary"> |
| 145 | +<ul class="summary-list"> |
| 146 | +<!-- =========== ANNOTATION INTERFACE OPTIONAL MEMBER SUMMARY =========== --> |
| 147 | +<li> |
| 148 | +<section class="member-summary" id="annotation-interface-optional-element-summary"> |
| 149 | +<h2>Optional Element Summary</h2> |
| 150 | +<div class="caption"><span>Optional Elements</span></div> |
| 151 | +<div class="summary-table three-column-summary"> |
| 152 | +<div class="table-header col-first">Modifier and Type</div> |
| 153 | +<div class="table-header col-second">Optional Element</div> |
| 154 | +<div class="table-header col-last">Description</div> |
| 155 | +<div class="col-first even-row-color"><code>boolean</code></div> |
| 156 | +<div class="col-second even-row-color"><code><a href="#allowEmpty()" class="member-name-link">allowEmpty</a></code></div> |
| 157 | +<div class="col-last even-row-color"> |
| 158 | +<div class="block">Return true if the component does not need to have <a href="Memoize.html" title="annotation interface in arez.annotations"><code>Memoize</code></a> annotated methods match.</div> |
| 159 | +</div> |
| 160 | +<div class="col-first odd-row-color"><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div> |
| 161 | +<div class="col-second odd-row-color"><code><a href="#name()" class="member-name-link">name</a></code></div> |
| 162 | +<div class="col-last odd-row-color"> |
| 163 | +<div class="block">Return the name of the context parameter.</div> |
| 164 | +</div> |
| 165 | +<div class="col-first even-row-color"><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div> |
| 166 | +<div class="col-second even-row-color"><code><a href="#pattern()" class="member-name-link">pattern</a></code></div> |
| 167 | +<div class="col-last even-row-color"> |
| 168 | +<div class="block">Return a regular expression for matching the arez names of memoized methods where this context parameter is tracked.</div> |
| 169 | +</div> |
| 170 | +</div> |
| 171 | +</section> |
| 172 | +</li> |
| 173 | +</ul> |
| 174 | +</section> |
| 175 | +<section class="details" id="annotation-interface-element-detail"> |
| 176 | +<ul class="details-list"> |
| 177 | +<!-- ============ ANNOTATION INTERFACE MEMBER DETAIL =========== --> |
| 178 | +<li> |
| 179 | +<section class="member-details"> |
| 180 | +<h2>Element Details</h2> |
| 181 | +<ul class="member-list"> |
| 182 | +<li> |
| 183 | +<section class="detail" id="name()"> |
| 184 | +<h3>name</h3> |
| 185 | +<div class="member-signature"><span class="annotations">@Nonnull </span><span class="return-type"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span> <span class="element-name"><a href="../../src-html/arez/annotations/MemoizeContextParameter.html#line-97">name</a></span></div> |
| 186 | +<div class="block">Return the name of the context parameter. |
| 187 | + If not specified, then the name will be derived from the name of the method. |
| 188 | + <ul> |
| 189 | + <li>To derive the name from a push method then remove the "push" prefix.</li> |
| 190 | + <li>To derive the name from a pop method then remove the "pop" prefix.</li> |
| 191 | + <li>To derive the name from a capture method then remove the optional "capture" prefix else just use the method name if no such prefix.</li> |
| 192 | + </ul></div> |
| 193 | +<dl class="notes"> |
| 194 | +<dt>Returns:</dt> |
| 195 | +<dd>the name of the context parameter.</dd> |
| 196 | +</dl> |
| 197 | +<dl class="notes"> |
| 198 | +<dt>Default:</dt> |
| 199 | +<dd>"<default>"</dd> |
| 200 | +</dl> |
| 201 | +</section> |
| 202 | +</li> |
| 203 | +<li> |
| 204 | +<section class="detail" id="pattern()"> |
| 205 | +<h3>pattern</h3> |
| 206 | +<div class="member-signature"><span class="annotations">@Nonnull </span><span class="return-type"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span> <span class="element-name"><a href="../../src-html/arez/annotations/MemoizeContextParameter.html#line-105">pattern</a></span></div> |
| 207 | +<div class="block">Return a regular expression for matching the arez names of memoized methods where this context parameter is tracked.</div> |
| 208 | +<dl class="notes"> |
| 209 | +<dt>Returns:</dt> |
| 210 | +<dd>a regular expression for matching arez name of memoized methods.</dd> |
| 211 | +</dl> |
| 212 | +<dl class="notes"> |
| 213 | +<dt>Default:</dt> |
| 214 | +<dd>".*"</dd> |
| 215 | +</dl> |
| 216 | +</section> |
| 217 | +</li> |
| 218 | +<li> |
| 219 | +<section class="detail" id="allowEmpty()"> |
| 220 | +<h3>allowEmpty</h3> |
| 221 | +<div class="member-signature"><span class="return-type">boolean</span> <span class="element-name"><a href="../../src-html/arez/annotations/MemoizeContextParameter.html#line-116">allowEmpty</a></span></div> |
| 222 | +<div class="block">Return true if the component does not need to have <a href="Memoize.html" title="annotation interface in arez.annotations"><code>Memoize</code></a> annotated methods match. |
| 223 | + Otherwise, if no <a href="Memoize.html" title="annotation interface in arez.annotations"><code>Memoize</code></a> annotated methods match the <a href="#pattern()"><code>pattern()</code></a> then the annotation |
| 224 | + processor will generate an error.</div> |
| 225 | +<dl class="notes"> |
| 226 | +<dt>Returns:</dt> |
| 227 | +<dd>true if the memoized methods must match annotation, false otherwise.</dd> |
| 228 | +</dl> |
| 229 | +<dl class="notes"> |
| 230 | +<dt>Default:</dt> |
| 231 | +<dd>false</dd> |
| 232 | +</dl> |
| 233 | +</section> |
| 234 | +</li> |
| 235 | +</ul> |
| 236 | +</section> |
| 237 | +</li> |
| 238 | +</ul> |
| 239 | +</section> |
| 240 | +<!-- ========= END OF CLASS DATA ========= --> |
| 241 | +</main> |
| 242 | +</div> |
| 243 | +</div> |
| 244 | +</body> |
| 245 | +</html> |
0 commit comments