KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > runtime > reflect > ConstructorSignatureImpl


1 /* *******************************************************************
2  * Copyright (c) 1999-2001 Xerox Corporation,
3  * 2002 Palo Alto Research Center, Incorporated (PARC).
4  * All rights reserved.
5  * This program and the accompanying materials are made available
6  * under the terms of the Eclipse Public License v1.0
7  * which accompanies this distribution and is available at
8  * http://www.eclipse.org/legal/epl-v10.html
9  *
10  * Contributors:
11  * Xerox/PARC initial implementation
12  * ******************************************************************/

13
14
15 package org.aspectj.runtime.reflect;
16
17 import java.lang.reflect.Constructor JavaDoc;
18
19 import org.aspectj.lang.reflect.ConstructorSignature;
20
21 class ConstructorSignatureImpl extends CodeSignatureImpl implements ConstructorSignature {
22     private Constructor JavaDoc constructor;
23     
24     ConstructorSignatureImpl(int modifiers, Class JavaDoc declaringType,
25         Class JavaDoc[] parameterTypes, String JavaDoc[] parameterNames, Class JavaDoc[] exceptionTypes)
26     {
27         super(modifiers, "<init>", declaringType, parameterTypes, parameterNames, exceptionTypes);
28     }
29     
30     ConstructorSignatureImpl(String JavaDoc stringRep) {
31         super(stringRep);
32     }
33     
34     public String JavaDoc getName() { return "<init>"; }
35     
36     protected String JavaDoc createToString(StringMaker sm) {
37         StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
38         buf.append(sm.makeModifiersString(getModifiers()));
39         buf.append(sm.makePrimaryTypeName(getDeclaringType(),getDeclaringTypeName()));
40         sm.addSignature(buf, getParameterTypes());
41         sm.addThrows(buf, getExceptionTypes());
42         return buf.toString();
43     }
44     
45     /* (non-Javadoc)
46      * @see org.aspectj.runtime.reflect.MemberSignatureImpl#createAccessibleObject()
47      */

48     public Constructor JavaDoc getConstructor() {
49         if (constructor == null) {
50             try {
51                 constructor = getDeclaringType().getDeclaredConstructor(getParameterTypes());
52             } catch (Exception JavaDoc ex) {
53                 ; // nothing we can do, caller will see null
54
}
55         }
56         return constructor;
57     }
58 }
59
Popular Tags