Android Annotation Libray

AnimatorResDenotes that an integer parameter, field or method return value is expected to be an animator resource reference (e.g. 
AnimResDenotes that an integer parameter, field or method return value is expected to be an anim resource reference (e.g. 
AnyResDenotes that an integer parameter, field or method return value is expected to be a resource reference of any type. 
AnyThreadDenotes that the annotated method can be called from any thread (e.g. 
ArrayResDenotes that an integer parameter, field or method return value is expected to be an array resource reference (e.g. 
AttrResDenotes that an integer parameter, field or method return value is expected to be an attribute reference (e.g. 
BinderThreadDenotes that the annotated method should only be called on the binder thread. 
BoolResDenotes that an integer parameter, field or method return value is expected to be a boolean resource reference. 
CallSuperDenotes that any overriding methods should invoke this method as well. 
CheckResultDenotes that the annotated method returns a result that it typically is an error to ignore. 
ColorIntDenotes that the annotated element represents a packed color int, AARRGGBB
ColorLong

Denotes that the annotated element represents a packed color long. 

ColorResDenotes that an integer parameter, field or method return value is expected to be a color resource reference (e.g. 
DimenResDenotes that an integer parameter, field or method return value is expected to be a dimension resource reference (e.g. 
DimensionDenotes that an integer parameter, field or method return value is expected to represent a dimension. 
DrawableResDenotes that an integer parameter, field or method return value is expected to be a drawable resource reference (e.g. 
FloatRangeDenotes that the annotated element should be a float or double in the given range

Example:

  @FloatRange(from=0.0,to=1.0)
  public float getAlpha() {
      ... 
          
    

        
FontResDenotes that an integer parameter, field or method return value is expected to be a font resource reference (e.g. 
FractionResDenotes that an integer parameter, field or method return value is expected to be a fraction resource reference. 
GuardedByDenotes that the annotated method or field can only be accessed when holding the referenced lock. 
HalfFloat

Denotes that the annotated element represents a half-precision floating point value. 

IdResDenotes that an integer parameter, field or method return value is expected to be an id resource reference (e.g. 
IntDefDenotes that the annotated element of integer type, represents a logical type and that its value should be one of the explicitly named constants. 
IntegerResDenotes that an integer parameter, field or method return value is expected to be an integer resource reference (e.g. 
InterpolatorResDenotes that an integer parameter, field or method return value is expected to be an interpolator resource reference (e.g. 
IntRangeDenotes that the annotated element should be an int or long in the given range

Example:

  @IntRange(from=0,to=255)
  public int getAlpha() {
      ... 
          
    

        
KeepDenotes that the annotated element should not be removed when the code is minified at build time. 
LayoutResDenotes that an integer parameter, field or method return value is expected to be a layout resource reference (e.g. 
MainThreadDenotes that the annotated method should only be called on the main thread. 
MenuResDenotes that an integer parameter, field or method return value is expected to be a menu resource reference. 
NavigationResDenotes that an integer parameter, field or method return value is expected to be a navigation resource reference (e.g. 
NonNullDenotes that a parameter, field or method return value can never be null. 
NullableDenotes that a parameter, field or method return value can be null. 
PluralsResDenotes that an integer parameter, field or method return value is expected to be a plurals resource reference. 
PxDenotes that an integer parameter, field or method return value is expected to represent a pixel dimension. 
RawResDenotes that an integer parameter, field or method return value is expected to be a raw resource reference. 
RequiresApiDenotes that the annotated element should only be called on the given API level or higher. 
RequiresPermissionDenotes that the annotated element requires (or may require) one or more permissions. 
RequiresPermission.ReadSpecifies that the given permission is required for read operations. 
RequiresPermission.WriteSpecifies that the given permission is required for write operations. 
RestrictToDenotes that the annotated element should only be accessed from within a specific scope (as defined by RestrictTo.Scope). 
SizeDenotes that the annotated element should have a given size or length. 
StringDefDenotes that the annotated String element, represents a logical type and that its value should be one of the explicitly named constants. 
StringResDenotes that an integer parameter, field or method return value is expected to be a String resource reference (e.g. 
StyleableResDenotes that an integer parameter, field or method return value is expected to be a styleable resource reference (e.g. 
StyleResDenotes that an integer parameter, field or method return value is expected to be a style resource reference (e.g. 
TransitionResDenotes that an integer parameter, field or method return value is expected to be a transition resource reference. 
UiThreadDenotes that the annotated method or constructor should only be called on the UI thread. 
VisibleForTestingDenotes that the class, method or field has its visibility relaxed, so that it is more widely visible than otherwise necessary to make code testable. 
WorkerThreadDenotes that the annotated method should only be called on a worker thread. 
XmlResDenotes that an integer parameter, field or method return value is expected to be an XML resource reference. 

转载于:https://my.oschina.net/u/2363160/blog/1576714

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值