KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > example > HelloBean


1 package example;
2
3 import javax.annotation.Resource;
4
5 import javax.ejb.Stateless JavaDoc;
6 import javax.ejb.TransactionAttribute JavaDoc;
7 import static javax.ejb.TransactionAttributeType.SUPPORTS JavaDoc;
8
9 /**
10  * Implementation of the Hello bean.
11  */

12 @Stateless JavaDoc
13 public class HelloBean implements Hello {
14   private String JavaDoc _greeting = "Default Hello";
15
16   /**
17    * Injector to set the greeting.
18    */

19   @Resource
20   public void setGreeting(String JavaDoc greeting)
21   {
22     _greeting = greeting;
23   }
24   
25   /**
26    * Returns a hello, world string.
27    */

28   @TransactionAttribute JavaDoc(SUPPORTS)
29   public String JavaDoc hello()
30   {
31     return _greeting;
32   }
33 }
34
Popular Tags