zoukankan      html  css  js  c++  java
  • annotation

    一、什么是annotation

    java.lang.annotation,接口 Annotation。对于Annotation,是Java5的新特性,JDK5引入了Metadata(元数据)很容易的就能够调用Annotations。Annotations提供一些本来不属于程序的数据,比如:一段代码的作者或者告诉禁止一编译器些特殊的错误。An annotation 对代码的执行没有什么影响。Annotations使用@annotation的形式应用于代码:类(class),属性(attribute),方法(method)等等。一个Annotation出现在上面提到的开始位置,而且一般只有一行,也可以包含有任意的参数

    二、已实现类

    public interface Annotation所有 annotation 类型都要扩展的公共接口。注意,手动扩展该公共接口的接口不定义 annotation 类型。还要注意此接口本身不定义 annotation 类型。
    对于Annotation,是Java5的新特性,下面是Sun的Tutorial的描述,因为是英文,这里我翻译下,希望能够比较清晰的描述一下Annotation的语法以及思想。Annotation:Release 5.0 of the JDK introduced a metadata facility called annotations. Annotations provide data about a program that is not part of the program,such as naming the author of a piece of code or instructing the compiler to suppress specific errors. An annotation has no effect on how the code performs. Annotations use the form @annotation and may be applied to a program's declarations: its classes,fields,methods,and so on. The annotation appears first and often (by convention) on its own line,and may include optional arguments: JDK5引入了Metadata(元数据)很容易的就能够调用Annotations.Annotations提供一些本来不属于程序的数据,比如:一段代码的作者或者告诉编译器禁止一些特殊的错误。An annotation 对代码的执行没有什么影响。Annotations使用@annotation的形式应用于代码:类(class),属性(field),方法(method)等等。一个Annotation出现在上面提到的开始位置,而且一般只有一行,也可以包含有任意的参数。
  • 相关阅读:
    python修改pip源
    python if条件判断dataframe是否为空
    bowtie和bowtie2使用条件区别及用法
    bat批处理for循环嵌套
    常用的数据标准化方法
    python学习——利用循环实现分类散点图绘制
    python学习——通过命令行参数根据fasta文件中染色体id提取染色体序列
    python学习——把读取fasta文件的代码封装成函数
    python学习——把计算GC含量的代码封装成函数
    python学习——使用argparse参数解释器传递命令行参数
  • 原文地址:https://www.cnblogs.com/everest7/p/10548202.html
Copyright © 2011-2022 走看看