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