RestrictTo
public
abstract
@interface
RestrictTo
implements
Annotation
android.support.annotation.RestrictTo |
Denotes that the annotated element should only be accessed from within a
specific scope (as defined by RestrictTo.Scope
).
Example of restricting usage within a library (based on gradle group ID):
@RestrictTo(GROUP_ID)
public void resetPaddingToInitialValues() { ...
Example of restricting usage to tests:
@RestrictScope(TESTS)
public abstract int getUserId();
Example of restricting usage to subclasses:
@RestrictScope(SUBCLASSES)
public void onDrawForeground(Canvas canvas) { ...
Summary
Nested classes | |
---|---|
enum |
RestrictTo.Scope
|
Public methods | |
---|---|
Scope[]
|
value()
The scope to which usage should be restricted. |
Inherited methods | |
---|---|
From
interface
java.lang.annotation.Annotation
|
Public methods
Annotations
- AnimatorRes
- AnimRes
- AnyRes
- AnyThread
- ArrayRes
- AttrRes
- BinderThread
- BoolRes
- CallSuper
- CheckResult
- ColorInt
- ColorLong
- ColorRes
- DimenRes
- Dimension
- DrawableRes
- FloatRange
- FontRes
- FractionRes
- GuardedBy
- HalfFloat
- IdRes
- IntDef
- IntegerRes
- InterpolatorRes
- IntRange
- Keep
- LayoutRes
- LongDef
- MainThread
- MenuRes
- NavigationRes
- NonNull
- Nullable
- PluralsRes
- Px
- RawRes
- RequiresApi
- RequiresPermission
- RequiresPermission.Read
- RequiresPermission.Write
- RestrictTo
- Size
- StringDef
- StringRes
- StyleableRes
- StyleRes
- TransitionRes
- UiThread
- VisibleForTesting
- WorkerThread
- XmlRes
Enums
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-04-11 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-11 UTC."],[],[]]