On Oct 13, 11:49 pm, Lawrence Louie <[email protected]> wrote: > Hi, > > Thanks for your detail explanation. From my understanding in a real world > example, the annotation does not get used often in the Java itself until it > gets to J2EE or web service, is that right? There is the @Override annotation which can be used about anywhere (not only on methods). The annotations on Beans are actually used heavily on GUI since there are basically Beans. The rest of the annotations are used either for documenting, or for XML, Web services, Databases, and J2EE.
For a good review of what is new in Java 1.6, you may want to browse quickly (or not depending of your wanting to increase your knowledge): http://www.javabeat.net/articles/13-introduction-to-java-60-new-features-parti-1.html (first page especially on annotations) http://www.javabeat.net/articles/14-java-60-features-part-2-pluggable-annotation-proce-1.html (also first page) You have also of course the annotations in Java 6: http://download.oracle.com/javase/6/docs/api/java/lang/annotation/Annotation.html where you will find in each of them examples of usage. Michèle Garoche > > Lawrence > > > > On Wed, Oct 13, 2010 at 12:09 AM, jitesh dundas <[email protected]> wrote: > > one of the best explaination that I have seen till now.. > > > thanks, > > jd > > > On 10/13/10, Michèle Garoche <[email protected]> wrote: > > > > On Oct 13, 3:48 am, Lawrence Louie <[email protected]> wrote: > > >> Hi, > > > >> Can you please provide some sample in terms of how the main program > > >> will actually get used the member annotation? Thx. > > > There numerous case of usage of annotations with values. You would > > > have already seen one of them: > > > @SuppressWarnings({"unchecked"}) > > > public void someMethodWhichIssueAnUncheckedWarning(...) > > > > Now, in Java 1.6, the annotations have been extended. There are used > > > for declaring operation in Web Services for example: > > > �...@webmethod(operationName = "add") > > > public int add(@WebParam(name = "i") int i, @WebParam(name = "j") int > > > j) { > > > return i + j; > > > } > > > > Another example for declaring servlet: > > > @WebServlet(urlPatterns = "/AsyncServlet", asyncSupported = true) > > > public class AsyncServlet extends HttpServlet { > > > > To declare constraints on Beans: > > > �...@size(max=40) > > > String address; > > > > In GWT, for example to mark parametrized or not String as to be > > > internationalized: > > > @DefaultMessage("{0}, life is worth living with... Passion!") > > > String alertMessage(String userName); > > > > etc, etc... > > > > There are really used about everywhere as soon as you enter the Java > > > EE world. > > > > Michèle Garoche > > > > -- > > > To post to this group, send email to > > > [email protected] > > > To unsubscribe from this group, send email to > > > [email protected]<javaprogrammingwith > > > passion%[email protected]> > > > For more options, visit this group at > > >http://groups.google.com/group/javaprogrammingwithpassion?hl=en > > > -- > > To post to this group, send email to > > [email protected] > > To unsubscribe from this group, send email to > > [email protected]<javaprogrammingwith > > passion%[email protected]> > > For more options, visit this group at > >http://groups.google.com/group/javaprogrammingwithpassion?hl=en -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en
