summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/CountBean.java
diff options
context:
space:
mode:
Diffstat (limited to 'Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/CountBean.java')
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/CountBean.java47
1 files changed, 47 insertions, 0 deletions
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/CountBean.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/CountBean.java
new file mode 100644
index 0000000..0a2ab2c
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/session/stateful_dd/CountBean.java
@@ -0,0 +1,47 @@
+package examples.session.stateful_dd;
+
+import java.io.Serializable;
+
+/**
+ * A Stateful Session Bean Class that shows the basics of
+ * how to write a stateful session bean.
+ *
+ * This Bean is initialized to some integer value. It has a
+ * business method which increments the value.
+ *
+ * The annotations below declare that:
+ * <ul>
+ * <li>this is a Stateful Session Bean
+ * <li>the bean's remote business interface is <code>Count</code>
+ * <li>any lifecycle callbacks go to the class <code>CountCallbacks</code>
+ * </ul>
+ */
+
+public class CountBean implements Count {
+
+ /** The current counter is our conversational state. */
+ private int val;
+
+ /**
+ * The count() business method.
+ */
+ public int count() {
+ System.out.println("count()");
+ return ++val;
+ }
+
+ /**
+ * The set() business method.
+ */
+ public void set(int val) {
+ this.val = val;
+ System.out.println("set()");
+ }
+
+ /**
+ */
+ public void remove() {
+ System.out.println("remove()");
+ }
+
+}