RestrictTo

annotation RestrictTo


Denotes that the annotated element should only be accessed from within a specific scope (as defined by 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 types

RestrictTo.Scope

Public methods

abstract @NonNull Array<@NonNull RestrictTo.Scope>

The scope to which usage should be restricted.

Public methods

value

@NonNull
public abstract Array<@NonNull RestrictTo.Scopevalue()

The scope to which usage should be restricted.