@Retention(value=CLASS)
@Target(value={ANNOTATION_TYPE,TYPE,METHOD,CONSTRUCTOR,FIELD,PACKAGE})
public @interface RestrictTo
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) { ...
Modifier and Type | Required Element and Description |
---|---|
RestrictTo.Scope[] |
value
The scope to which usage should be restricted.
|
public abstract RestrictTo.Scope[] value