Z
zakmck73
Hi all,
I have a question about Java annotations. I find weird I cannot
annotate something multiple times using the same annotation type. For
instance I cannot do this:
@TODO ( type = "urgent", "Fix the bugs!" )
@TODO ( type = "low priority", "Check the comments" )
public class Foo
{
....
}
I wish that on the reflection side I had something like
getAnnotationsByType ( Class clazz ).
To make another example, if I use Hibernate annotations, I cannot
define multiple mappings from two different databases to the same
class.
Would someone comment on this strange restriction? Any chance things
will be improved in future? Does anyone know a workaround? I have seen
examples like this:http://java.sun.com/javase/6/docs/api/javax/xml/
bind/annotation/XmlElements.html
Any better idea?
Thanks in advance for any help
I have a question about Java annotations. I find weird I cannot
annotate something multiple times using the same annotation type. For
instance I cannot do this:
@TODO ( type = "urgent", "Fix the bugs!" )
@TODO ( type = "low priority", "Check the comments" )
public class Foo
{
....
}
I wish that on the reflection side I had something like
getAnnotationsByType ( Class clazz ).
To make another example, if I use Hibernate annotations, I cannot
define multiple mappings from two different databases to the same
class.
Would someone comment on this strange restriction? Any chance things
will be improved in future? Does anyone know a workaround? I have seen
examples like this:http://java.sun.com/javase/6/docs/api/javax/xml/
bind/annotation/XmlElements.html
Any better idea?
Thanks in advance for any help