01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.aspectwerkz.joinpoint.impl;
05:
06: import com.tc.aspectwerkz.joinpoint.CatchClauseSignature;
07: import com.tc.aspectwerkz.joinpoint.Signature;
08:
09: /**
10: * Implementation for the catch clause signature.
11: *
12: * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
13: */
14: public class CatchClauseSignatureImpl implements CatchClauseSignature {
15:
16: private Class m_exceptionType;
17:
18: /**
19: * Creates a new catch clause signature.
20: *
21: * @param exceptionClass
22: */
23: public CatchClauseSignatureImpl(final Class exceptionClass) {
24: m_exceptionType = exceptionClass;
25: }
26:
27: /**
28: * Returns the exception class.
29: *
30: * @return the declaring class
31: */
32: public Class getDeclaringType() {
33: return m_exceptionType;
34: }
35:
36: /**
37: * Returns the modifiers for the signature. <p/>Could be used like this:
38: * <p/>
39: * <pre>
40: * boolean isPublic = java.lang.reflect.Modifier.isPublic(signature.getModifiers());
41: * </pre>
42: *
43: * @return the mofifiers
44: */
45: public int getModifiers() {
46: return m_exceptionType.getModifiers();
47: }
48:
49: /**
50: * Returns the name
51: *
52: * @return the name
53: */
54: public String getName() {
55: return m_exceptionType.getName();
56: }
57:
58: /**
59: * Returns the exception type.
60: *
61: * @return the parameter type
62: */
63: public Class getParameterType() {
64: return m_exceptionType;
65: }
66:
67: /**
68: * Returns a string representation of the signature.
69: *
70: * @return a string representation
71: */
72: public String toString() {
73: return getName();
74: }
75:
76: /**
77: * Creates a deep copy of the signature.
78: *
79: * @return a deep copy of the signature
80: */
81: public Signature newInstance() {
82: return new CatchClauseSignatureImpl(m_exceptionType);
83: }
84: }
|