Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
added in version 1.0.0
belongs to Maven artifact androidx.annotation:annotation:1.0.0-rc01

RestrictTo

public abstract @interface RestrictTo
implements Annotation

androidx.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

Public methods

value

public Scope[] value ()

The scope to which usage should be restricted.

Returns
Scope[]