blob: 4b424e966868d2a5de56bee02f20ecd76c61f60f [file]
<html devsite="true">
<head>
<title>RestrictTo</title>
{% setvar book_path %}/reference/dokkatest/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<div itemscope="" itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="RestrictTo">
<meta itemprop="path" content="androidx.annotation">
<meta itemprop="property" content="getValue()">
<meta itemprop="language" content="JAVA">
</div>
<div id="header-block">
<div>
<h1>RestrictTo</h1>
</div>
</div>
<div id="refdoc-switcher-placeholder"></div>
<p>
<pre>@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.annotation/-must-be-documented/index.html">MustBeDocumented</a><br>@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.annotation/-retention/index.html">Retention</a>(value&nbsp;=&nbsp;AnnotationRetention.BINARY)<br>@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.annotation/-target/index.html">Target</a>(allowedTargets&nbsp;=&nbsp;[AnnotationTarget.ANNOTATION_CLASS,&nbsp;AnnotationTarget.CLASS,&nbsp;AnnotationTarget.FUNCTION,&nbsp;AnnotationTarget.PROPERTY_GETTER,&nbsp;AnnotationTarget.PROPERTY_SETTER,&nbsp;AnnotationTarget.CONSTRUCTOR,&nbsp;AnnotationTarget.FIELD,&nbsp;AnnotationTarget.FILE])<br>@<a href="https://developer.android.com/reference/java/lang/annotation/Target.html">Target</a>(value&nbsp;=&nbsp;[ElementType.ANNOTATION_TYPE,&nbsp;ElementType.TYPE,&nbsp;ElementType.METHOD,&nbsp;ElementType.CONSTRUCTOR,&nbsp;ElementType.FIELD,&nbsp;ElementType.PACKAGE])<br>public annotation <a href="/reference/androidx/annotation/RestrictTo.html">RestrictTo</a></pre>
</p>
<hr>
<p>Denotes that the annotated element should only be accessed from within a specific scope (as defined by <code><a href="/reference/androidx/annotation/RestrictTo.Scope.html">Scope</a></code>).</p>
<p>Example of restricting usage within a library (based on gradle group ID):</p>
<pre class="prettyprint">@RestrictTo(GROUP_ID)<br>public void resetPaddingToInitialValues() { ...</pre>
<p>Example of restricting usage to tests:</p>
<pre class="prettyprint">@RestrictTo(Scope.TESTS)<br>public abstract int getUserId();</pre>
<p>Example of restricting usage to subclasses:</p>
<pre class="prettyprint">@RestrictTo(Scope.SUBCLASSES)<br>public void onDrawForeground(Canvas canvas) { ...</pre>
<h2>Summary</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%"><h3>Nested types</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td>
<div><code>public enum <a href="/reference/androidx/annotation/RestrictTo.Scope.html">RestrictTo.Scope</a> extends <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html">Enum</a></code></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%"><h3>Public constructors</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td>
<div><code><a href="/reference/androidx/annotation/RestrictTo.html#RestrictTo(kotlin.Array)">RestrictTo</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/annotation/RestrictTo.Scope.html">RestrictTo.Scope</a>&nbsp;value)</code></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%"><h3>Public methods</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> RestrictTo.Scope[]</code></td>
<td>
<div><code><a href="/reference/androidx/annotation/RestrictTo.html#getValue()">getValue</a>()</code></div>
<p>The scope to which usage should be restricted.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="list">
<h2>Public constructors</h2>
<div class="api-item"><a name="RestrictTo-kotlin.Array-"></a><a name="restrictto"></a>
<div class="api-name-block">
<div>
<h3 id="RestrictTo(kotlin.Array)">RestrictTo</h3>
</div>
</div>
<pre class="api-signature no-pretty-print">public&nbsp;<a href="/reference/androidx/annotation/RestrictTo.html#RestrictTo(kotlin.Array)">RestrictTo</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/annotation/RestrictTo.Scope.html">RestrictTo.Scope</a>&nbsp;value)</pre>
</div>
</div>
<div class="list">
<h2>Public methods</h2>
<div class="api-item"><a name="getValue--"></a><a name="getvalue"></a>
<div class="api-name-block">
<div>
<h3 id="getValue()">getValue</h3>
</div>
</div>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> RestrictTo.Scope[]&nbsp;<a href="/reference/androidx/annotation/RestrictTo.html#getValue()">getValue</a>()</pre>
<p>The scope to which usage should be restricted.</p>
</div>
</div>
</body>
</html>