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