KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > aspectwerkz > joinpoint > impl > CatchClauseSignatureImpl


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.aspectwerkz.joinpoint.impl;
5
6 import com.tc.aspectwerkz.joinpoint.CatchClauseSignature;
7 import com.tc.aspectwerkz.joinpoint.Signature;
8
9 /**
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 JavaDoc m_exceptionType;
17
18   /**
19    * Creates a new catch clause signature.
20    *
21    * @param exceptionClass
22    */

23   public CatchClauseSignatureImpl(final Class JavaDoc exceptionClass) {
24     m_exceptionType = exceptionClass;
25   }
26
27   /**
28    * Returns the exception class.
29    *
30    * @return the declaring class
31    */

32   public Class JavaDoc 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 JavaDoc getName() {
55     return m_exceptionType.getName();
56   }
57
58   /**
59    * Returns the exception type.
60    *
61    * @return the parameter type
62    */

63   public Class JavaDoc 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 JavaDoc 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 }
Popular Tags