1 11 12 package org.eclipse.jdt.apt.core.internal.declaration; 13 14 import org.eclipse.jdt.apt.core.internal.env.BaseProcessorEnv; 15 import org.eclipse.jdt.core.dom.IMethodBinding; 16 17 import com.sun.mirror.declaration.ConstructorDeclaration; 18 import com.sun.mirror.declaration.ParameterDeclaration; 19 import com.sun.mirror.util.DeclarationVisitor; 20 21 public class ConstructorDeclarationImpl extends ExecutableDeclarationImpl implements ConstructorDeclaration 22 { 23 public ConstructorDeclarationImpl(final IMethodBinding binding, BaseProcessorEnv env) 24 { 25 super(binding, env); 26 assert binding.isConstructor() : "binding does not represent a constructor"; } 28 29 public void accept(DeclarationVisitor visitor) 30 { 31 visitor.visitConstructorDeclaration(this); 32 } 33 34 public MirrorKind kind(){ return MirrorKind.CONSTRUCTOR; } 35 36 public String toString() 37 { 38 final StringBuilder buffer = new StringBuilder (); 39 final IMethodBinding methodBinding = getDeclarationBinding(); 40 buffer.append(methodBinding.getName()); 41 buffer.append('('); 42 int i=0; 43 for( ParameterDeclaration param : getParameters() ){ 44 if( i++ != 0 ) 45 buffer.append(", "); buffer.append(param); 47 } 48 buffer.append(')'); 49 50 return buffer.toString(); 51 } 52 } 53 54 | Popular Tags |