Delphi 中的嵌套属性(续) [英] Nested Attributes in Delphi (Continued)

查看:21
本文介绍了Delphi 中的嵌套属性(续)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题指的是之前 one 在 SO 上由 克里斯蒂安·梅茨勒.

This question refers to this prior one posted here on SO by Christian Metzler.

我关于注解的唯一非常有限的经验是使用最近的 Delphi 版本中引入的 CustomAttribute.

My only very limited experience regarding annotion consists of using CustomAttribute introduced in recent Delphi versions.

我的问题:

  • 是否有其他语言实现了嵌套属性功能(用于注释).

推荐答案

Java 编程语言中,可以声明嵌套注释类型.

In the Java programming language it is possible to declare nested annotation types.

示例参考:

http://javahowto.blogspot.com/2006/07/java-annotations-with-no-target.html

http://www.trevorpounds.com/blog/?p=314

这是 javax.persistence.EntityResult 文档中的一个示例,在 3 个不同级别有 3 个嵌套注释:

Here is an example from the javax.persistence.EntityResult docs, with 3 nested annotations at 3 different levels:

@SqlResultSetMapping(name="OrderResults",
 entities={
     @EntityResult(entityClass=com.acme.Order.class, fields={
         @FieldResult(name="id", column="order_id"),
         @FieldResult(name="quantity", column="order_quantity"),
         @FieldResult(name="item", column="order_item")})},
 columns={
     @ColumnResult(name="item_name")}
)

这篇关于Delphi 中的嵌套属性(续)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆