RestrictTo This package is part of the Android support library which is no longer maintained. The support library has been superseded by AndroidX which is part of Jetpack . We recommend using the AndroidX libraries in all new projects. You should also consider migrating existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library class mappings . 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
abstract Class<? extends Annotation> annotationType() abstract boolean equals(Object arg0) abstract int hashCode() abstract String toString()
Public methods value
Scope[] value () The scope to which usage should be restricted.
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 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[]]