Proccessing Annotations and design problem

Hi Experts,

I have a problem in designing an Api

I define a bunch of annotations for my value objects at runtime, currently I have a AnnotationUtil class in which read all fields of the given classes and put the field name and its annotation in a Map structure so whenever I need to know the annotation for a field I obtain it through that Map

but I think this is not a good design and it's really simple and if I add or make any change in my annotation the util class should be revised

I want to know if there is any design pattern to process annotations,

I want to know how Apis like hibernate will handle their annotations

any suggestion or comment would be of great help

thank you very much in advance

[757 byte] By [java1357a] at [2007-11-27 6:57:09]
# 1

Hello, you can see this article

http://www.fusionsoft-online.com/articles-java-annotations.php

and get annotations for classes or methods using code like:

AnnotatedClass annotatedClass =

AnnotationManager.getAnnotatedClass(Derived.class);

annotatedClass.getAnnotation(A.class);

AnnotatedMethod annotatedMethod = annotatedClass

.getAnnotatedMethod("method1", new Class[0]);

annotatedMethod.getAnnotation(B.class);

as well as

get all annotated methods of the class (empty if none)

getAnnotatedMethods()

and get all the inherited or declared annotations

getAllAnnotations()

Regards, Michael.

fusionsoft-onlinea at 2007-7-12 18:34:20 > top of Java-index,Other Topics,Patterns & OO Design...