For example, java.lang.annotations.Target takes one or more enum
values, e.g.,
@Target(ElementType.ANNOTATION_TYPE)
public @interface MetaAnnotationValidOnlyForOtherAnnotations {
...
}
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR})
public @interface AnnotationValidForFieldsMethodsAndConstructors {
...
}
You can cut down on the number of annotations you have to define by
using data to distinguish between the different cases. That's all I
meant.
Good luck!
dean
mouna SAHIB wrote:
Hello Dean,
I'm not sure I understand what you mean; I'm sorry! :$
Can you give me an example please?
Thanks!
Mouna
2006/4/19, Dean Wampler <
deanwampler@xxxxxxxxx>:
No,
annotations are like regular classes & interfaces. They have to be
declared and defined.
Can you reduce the number of annotations you need by embedding
information in them, for example, by using, a descriptive string or an
enum, like the ones used by the predefined @Target and @Retention
annotations?
Dean
On 4/19/06, mouna SAHIB <mouna.sahib@xxxxxxxxx>
wrote:
> I have a question about using annotations to reference methods but
not in
> relation with the errors I had:
> Is it necessary to create annotations interfaces to use them? I
expected to
> have the possiblity of tagging my methods like this:
>
> @MyMethod
> public void MaMethode(){
> /*
> * some code
> */
> }
> Without creating the interface:
> public @interface MyMethod {
> }
>
> Is it possible?
> If not, that means that I have to create as much interfaces as
annotations
> I'm using! It's not very appreciable if I have many annotations to
use! Is
> it?
>
--
Dean Wampler
http://www.aspectprogramming.com
http://www.newaspects.com
http://www.contract4j.org
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users
--
Dean Wampler, Ph.D.
dean at aspectprogramming.com
http://www.aspectprogramming.com
http://www.contract4j.org
I want my tombstone to say:
Unknown Application Error in Dean Wampler.exe.
Application Terminated.
[Okay] [Cancel]
|