博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
源码-hadoop1.1.0-core-org.apache.hadoop.classification
阅读量:6856 次
发布时间:2019-06-26

本文共 2628 字,大约阅读时间需要 8 分钟。


  

里面放着两个注解类:InterfaceAudience和InterfaceStability。

InterfaceAudience 类包含三个注解类型,用来被说明被他们注解的类型的潜在的使用范围(audience)。

         @InterfaceAudience.Public: 对所有工程和应用可用
         @InterfaceAudience.LimitedPrivate: 仅限于某些特定工程,如Comomn,HDFS等
         @InterfaceAudience.Private: 仅限于Hadoop
InterfaceStability 类包含三个注解,用于说明被他们注解的类型的稳定性。
         @InterfaceStability.Stable: 主版本是稳定的,不同主版本间可能不兼容
         @InterfaceStability.Evolving: 不断变化,不同次版本间可能不兼容
         @InterfaceStability.Unstable: 没有任何可靠性和健壮性保证


 

1 /** 2 *注释省略... 3 **/ 4 package org.apache.hadoop.classification; 5  6 import java.lang.annotation.Documented; 7 //只引入了JDK的注释包中的Documented接口,即没有其他hadoop类级联 8 /** 9  * Annotation to inform users of a package, class or method's intended audience.10  */11 //这里面也是注解类,用来向用户表明一个包、类或者方法的潜在的使用范围12 @InterfaceAudience.Public13 @InterfaceStability.Evolving14 //自注解(自己起的名字)。第一个注解就用到了这个类中的第一个内部注解。第二个是同包下的第二个类(不解释)。15 public class InterfaceAudience {16   /**17    * Intended for use by any project or application.18    */19   @Documented public @interface Public {};20   //@Doccumented 是元注解(就是注解注解的注解),作用是指示某一类型的注释将通过 javadoc 和类似的默认工具进行文档化。21   //这个注解是标识适用任何工程或者应用22   /**23    * Intended only for the project(s) specified in the annotation.24    * For example, "Common", "HDFS", "MapReduce", "ZooKeeper", "HBase".25    */26   @Documented public @interface LimitedPrivate {27     String[] value();28   };29   //标识适用于某些特殊的工程。比如HDFS、Mapreduce等30   //它的值是个字符串数组,表示可以是多个工程31   32   /**33    * Intended for use only within Hadoop itself.34    */35   @Documented public @interface Private {};36 //只适用于hadoop自己37   private InterfaceAudience() {} // Audience can't exist on its own38 //构造方法,私有的。已有注释39 }

关于元注解和自定义注解  


1 package org.apache.hadoop.classification; 2  3 import java.lang.annotation.Documented; 4  5 /** 6  * Annotation to inform users of how much to rely on a particular package, 7  * class or method not changing over time. 8  */ 9  //说明被他们注解的类型的稳定性10 @InterfaceAudience.Public11 @InterfaceStability.Evolving12 public class InterfaceStability {13   /**14    * Can evolve while retaining compatibility for minor release boundaries.; 15    * can break compatibility only at major release (ie. at m.0).16    */17   @Documented18   public @interface Stable {};19   //主版本是稳定的,不同主版本间可能不兼容20   /**21    * Evolving, but can break compatibility at minor release (i.e. m.x)22    */23   @Documented24   public @interface Evolving {};25   //不断变化,不同次版本间可能不兼容26   /**27    * No guarantee is provided as to reliability or stability across any28    * level of release granularity.29    */30   @Documented31   public @interface Unstable {};32   //没有任何可靠性和健壮性保证33 }

 

转载于:https://www.cnblogs.com/admln/p/classification.html

你可能感兴趣的文章
9、如何清空流及缓存
查看>>
gvim汉化及配置
查看>>
ubuntu下JMF RTP不支持单播接收
查看>>
fastboot烧写命令
查看>>
深度测试与alpha混合(1)
查看>>
15幅非常有创意的影子摄影作品欣赏
查看>>
SQL Server 2008 VALUES
查看>>
[算法] 已知在平面坐标系内有N个点,求离开给定坐标距离最近的10个点
查看>>
使用DMV和DMF分析数据库性能
查看>>
PHP验证IP地址输入的准确性:数组数值验证
查看>>
HashMap概述
查看>>
在rem布局下使用背景图片以及sprite
查看>>
JAVA设计模式之【抽象工厂模式】
查看>>
数字电视的电子节目指南(EPG)及其系统
查看>>
11 复用与多址
查看>>
附录A 编译安装Hadoop
查看>>
android studio building project info 错误
查看>>
【Scala】Scala之Control Structures
查看>>
三星手机拍照,从图库选择照片旋转问题完美解决
查看>>
算法笔记_173:历届试题 斐波那契(Java)
查看>>