小小的翻译,嘿嘿,翻译的不咋地

Annotations

注解

You’ve probably encountered the need to annotate elements ofyour Java applications by associating metadata (data that describes other data)with them. Java has always provided an ad hoc annotation mechanism via thetransient reserved word, which lets you annotate fields that are to be excludedduring serialization. But it didn’t offer a standard way to annotate programelements until Java 5.

你可能曾经遇到过需要将元数据(描述其他数据的数据)关联起来注释Java应用程序中的元素。Java常常通过transient保留字来提供一种特别的注释机制,这可以在序列化时排除你的注释域。但是直到Java5的出现,Java才提供了一种标准的方式来注释程序元素。

Java5’s general annotation mechanism consists offour components:

1.An@interface mechanism for declaring annotation types.
2.Meta-annotation types, which you can use to identify the application elementsto which an annotation type applies; to identify the lifetime of an annotation(an instance of an annotation type); and more.
3.Support for annotation processing via an extension to the Java ReflectionAPI, which you can use to discover a program’s runtime annotations, and theintroduction of a generalized tool for processing annotations.
4.Standard annotation types.

Java 5的一般注释机制由四部分组成:

1.在声明注释类型时@interface机制

2.元注释类型,一种你可以为应用程序元素定义一种特定的注释类型;定义一种注释的生命周期(一种注释类型的一个实例);或者更多。

3.支持通过扩展Java反射API来实现注释处理,你可以使用这个来发现一个程序的运行时注释,和处理注释的泛型工具的介绍。

4.标准的注释类型。

I’ll explainhow to use these components and point out some of the challenges of annotationsin the examples that follow.

我将解释如何使用这些组件,并且会指出下述例子中注释的一些具有挑战性的注释。


原文为:

Java 101: The next generation: The essential Java language features tour, Part 2

    Programming with typesafe enums and annotations in Java 5


这是在伯乐在线上的翻译测试任务吧,翻译的可能不咋地嘿嘿

红色部分是唐友华先生指正的


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值