1 11 12 package org.eclipse.jdt.apt.core.internal.declaration; 13 14 import java.util.Collection ; 15 16 import org.eclipse.jdt.apt.core.internal.env.BaseProcessorEnv; 17 import org.eclipse.jdt.apt.core.internal.util.Factory; 18 import org.eclipse.jdt.core.dom.IMethodBinding; 19 import org.eclipse.jdt.core.dom.ITypeBinding; 20 21 import com.sun.mirror.declaration.ExecutableDeclaration; 22 import com.sun.mirror.declaration.ParameterDeclaration; 23 import com.sun.mirror.declaration.TypeDeclaration; 24 import com.sun.mirror.declaration.TypeParameterDeclaration; 25 import com.sun.mirror.type.ReferenceType; 26 import com.sun.mirror.util.DeclarationVisitor; 27 28 public abstract class ExecutableDeclarationImpl 29 extends MemberDeclarationImpl implements ExecutableDeclaration 30 { 31 public ExecutableDeclarationImpl(final IMethodBinding binding, final BaseProcessorEnv env) 32 { 33 super(binding, env); 34 } 35 36 public void accept(DeclarationVisitor visitor) 37 { 38 visitor.visitExecutableDeclaration(this); 39 } 40 41 public TypeDeclaration getDeclaringType() 42 { 43 final IMethodBinding methodBinding = getDeclarationBinding(); 44 return Factory.createReferenceType(methodBinding.getDeclaringClass(), _env); 45 } 46 47 public Collection <TypeParameterDeclaration> getFormalTypeParameters() 48 { 49 return ExecutableUtil.getFormalTypeParameters(this, _env); 50 } 51 public Collection <ParameterDeclaration> getParameters() 52 { 53 return ExecutableUtil.getParameters(this, _env); 54 } 55 56 public Collection <ReferenceType> getThrownTypes() 57 { 58 return ExecutableUtil.getThrownTypes(this, _env); 59 } 60 61 public boolean isVarArgs() 62 { 63 return getDeclarationBinding().isVarargs(); 64 } 65 66 public String getSimpleName() 67 { 68 return getDeclarationBinding().getName(); 69 } 70 71 public IMethodBinding getDeclarationBinding() 72 { 73 return (IMethodBinding)_binding; 74 } 75 76 public boolean isFromSource() 77 { 78 final ITypeBinding type = getDeclarationBinding().getDeclaringClass(); 79 return ( type != null && type.isFromSource() ); 80 } 81 } 82 | Popular Tags |