01: package com.bm.ejb3metadata.annotations.impl;
02:
03: import java.lang.annotation.Annotation;
04:
05: import javax.ejb.ApplicationException;
06:
07: /**
08: * Acts as an implementation of @{@link javax.ejb.ApplicationException} annotation.
09: * @author Daniel Wiese
10: */
11: public class JApplicationException implements ApplicationException {
12:
13: /**
14: * Container rollback the transaction ? if an exception is thrown.
15: */
16: private boolean rollback = false;
17:
18: /**
19: * Build an object which represents @{@link javax.ejb.ApplicationException} annotation.<br>
20: * Default value for rollback is false.
21: */
22: public JApplicationException() {
23: this (false);
24: }
25:
26: /**
27: * Build an object which represents @{@link javax.ejb.ApplicationException} annotation with a given boolean.<br>
28: * @param rollback true/false (false is a default value)
29: */
30: public JApplicationException(final boolean rollback) {
31: this .rollback = rollback;
32: }
33:
34: /**
35: * @return the retainIfException value (true/false)
36: */
37: public boolean rollback() {
38: return rollback;
39: }
40:
41: /**
42: * @return annotation type
43: */
44: public Class<? extends Annotation> annotationType() {
45: return ApplicationException.class;
46: }
47:
48: /**
49: * @return string representation
50: */
51: @Override
52: public String toString() {
53: StringBuilder sb = new StringBuilder();
54: // classname
55: sb.append(this .getClass().getName().substring(
56: this .getClass().getPackage().getName().length() + 1));
57: // rollback
58: sb.append("[rollback=");
59: sb.append(rollback);
60:
61: sb.append("]");
62: return sb.toString();
63: }
64: }
|