`

注解example

阅读更多
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@Retention(RetentionPolicy.RUNTIME)
public @interface myAnnotation {
	String name() default "abc";
}
import java.lang.annotation.Annotation;

@myAnnotation
public class A {
	@myAnnotation
	public void a(){
		
	}
	public static void main(String[] args) throws Exception {
		System.out.println("测试annotation的默认值");
		A b = new A();
		myAnnotation annotations = b.getClass().getMethod("a",null).getAnnotation(myAnnotation.class);
		System.out.println(annotations.name().toString());
	}
}
 
分享到:
评论

相关推荐

    Dart by Example(John Ryan)Dart by Example (John Ryan)

    本书是使用带注释的示例程序亲手介绍Dart的,示例程序受Go By Example和Haskell By Example启发。 它将逐步引导您轻松,快速地构建数据驱动的Web应用程序。

    silvaco example.zip

    Silvaco TCAD 的很好地例子。例子覆盖常用的各种模型,以及详细的注释和用法。图文并茂。

    FFMPEG_Output_example.c_随机YUV

    FFMPEG_Output_example.c_随机YUV 随机产生yuv图像,并进行转码转为H264格式,本工程未改写源码,有详细的注释。

    Specification Example.docx

    ODOO需求规格书模板 一本好的规范是简短的,可视化的,结构如下: 1. 业务需求:案例及其解释为何客户特别需要该功能的理由(最多2或3段)。...幕截图或带有注释的模拟来进行说明。 3. 技术提示:开发人员必须注意的事项。

    express-swagger-example:用于演示Express API文档的示例项目

    速拨示例 用于将Swagger(OpenAPI)文档演示的示例项目已添加到Express后端。 跑步 npm install npm start 访问http://localhost:3000/api-docs以在Swagger UI中...开发 使用npm run start:dev以监视模式启动服务器。

    sruts2example

    sruts2example a good example of struts2

    GA-example.rar_遗传算法注释

    一个遗传算法的例子,非常容易理解,其中有详细注释

    Spring全注解Examples

    Spring 4.2.2 全注解配置,环境:吾用JDK 1.8,elcipse开发,吾能顺利运行.就看你的了

    libquic-client-server-example.zip

    quic、prot_quic、goquic、libquic源码中文注释分析,增加C++ quic-client和quic-server example 程序,便于快速掌握学习谷歌quic库源码和学习quic协议,作为新的网络加速协议,可以根据实际需要应用于自己的工程项目...

Global site tag (gtag.js) - Google Analytics