summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interceptors/AuditorInterceptor.java
diff options
context:
space:
mode:
Diffstat (limited to 'Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interceptors/AuditorInterceptor.java')
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interceptors/AuditorInterceptor.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interceptors/AuditorInterceptor.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interceptors/AuditorInterceptor.java
new file mode 100644
index 0000000..853a891
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Micah Examples/src/examples/stateless/interceptors/AuditorInterceptor.java
@@ -0,0 +1,18 @@
+package examples.stateless.interceptors;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+public class AuditorInterceptor {
+ @AroundInvoke
+ public Object checkCost(InvocationContext inv) throws Exception {
+ if (inv.getMethod().getName().startsWith("getTax")) {
+ Object[] o = inv.getParameters();
+ double cost = ((Double)o[0]).doubleValue();
+ if (cost > 50) {
+ System.out.println("Cost is > 50!");
+ }
+ }
+ return inv.proceed();
+ }
+}