【发布时间】:2011-12-19 17:10:08
【问题描述】:
这是我的注释:
@Target( { ElementType.METHOD } )
@Retention(RetentionPolicy.RUNTIME)
public @interface AuditUpdate
{
Class<?> value();
}
这样就可以了:
@AuditUpdate(User.class)
void someMethod(){}
但是通过这种方式:
private static final Class<?> ENTITY_CLASS = User.class;
@AuditUpdate(ENTITY_CLASS)
void someMethod(){}
我有这个编译错误:
The value for annotation attribute AuditUpdate.value must be a class literal
为什么?这是什么意思?
谢谢。
【问题讨论】:
标签: java annotations