1 13 14 15 package org.aspectj.runtime.reflect; 16 17 import org.aspectj.lang.reflect.InitializerSignature; 18 19 import java.lang.reflect.Constructor ; 20 import java.lang.reflect.Modifier ; 21 22 class InitializerSignatureImpl extends CodeSignatureImpl implements InitializerSignature { 23 private Constructor constructor; 24 25 InitializerSignatureImpl(int modifiers, Class declaringType) { 26 super(modifiers, Modifier.isStatic(modifiers) ? "<clinit>" : "<init>", declaringType, EMPTY_CLASS_ARRAY, 27 EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY); 28 } 29 30 InitializerSignatureImpl(String stringRep) { 31 super(stringRep); 32 } 33 34 public String getName() { 35 return Modifier.isStatic(getModifiers()) ? "<clinit>": "<init>"; 36 } 37 38 protected String createToString(StringMaker sm) { 39 StringBuffer buf = new StringBuffer (); 40 buf.append(sm.makeModifiersString(getModifiers())); 41 buf.append(sm.makePrimaryTypeName(getDeclaringType(),getDeclaringTypeName())); 42 buf.append("."); 43 buf.append(getName()); 44 return buf.toString(); 45 } 46 47 50 public Constructor getInitializer() { 51 if (constructor == null) { 52 try { 53 constructor = getDeclaringType().getDeclaredConstructor(getParameterTypes()); 54 } catch (Exception ex) { 55 ; } 57 } 58 return constructor; 59 } 60 } 61 | Popular Tags |