Nested Attributes in Delphi (Continued)

2019-07-20 22:02发布

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

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

My question:

  • Are there any other languages implementing nested attributes features (for annotation purpose).

1条回答
老娘就宠你
2楼-- · 2019-07-20 22:47

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

Example references:

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

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

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")}
)
查看更多
登录 后发表回答