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?
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]<javaprogrammingwithpassion%[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]<javaprogrammingwithpassion%[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
