1 11 12 package org.eclipse.jdt.apt.core.internal.declaration; 13 14 import com.sun.mirror.declaration.AnnotationTypeDeclaration; 15 import com.sun.mirror.declaration.AnnotationTypeElementDeclaration; 16 import com.sun.mirror.declaration.AnnotationValue; 17 import com.sun.mirror.declaration.ParameterDeclaration; 18 import com.sun.mirror.util.DeclarationVisitor; 19 import java.util.Collection ; 20 import java.util.Collections ; 21 22 import org.eclipse.jdt.apt.core.internal.env.BaseProcessorEnv; 23 import org.eclipse.jdt.apt.core.internal.util.Factory; 24 import org.eclipse.jdt.core.dom.ASTNode; 25 import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration; 26 import org.eclipse.jdt.core.dom.IMethodBinding; 27 28 public class AnnotationElementDeclarationImpl extends MethodDeclarationImpl implements AnnotationTypeElementDeclaration 29 { 30 public AnnotationElementDeclarationImpl(final IMethodBinding binding, 31 final BaseProcessorEnv env) 32 { 33 super(binding, env); 34 } 35 36 public void accept(DeclarationVisitor visitor) 37 { 38 visitor.visitAnnotationTypeElementDeclaration(this); 39 } 40 41 public AnnotationTypeDeclaration getDeclaringType() 42 { 43 return (AnnotationTypeDeclaration)super.getDeclaringType(); 44 } 45 46 52 public AnnotationValue getDefaultValue() 53 { 54 final IMethodBinding binding = getDeclarationBinding(); 55 final Object defaultValue = binding.getDefaultValue(); 56 return Factory.createDefaultValue(defaultValue, this, _env); 57 } 58 59 ASTNode getAstNodeForDefault() 60 { 61 final AnnotationTypeMemberDeclaration decl = (AnnotationTypeMemberDeclaration)getAstNode(); 62 if( decl != null ) 63 return decl.getDefault(); 64 65 return null; 66 } 67 68 public Collection <ParameterDeclaration> getParameters(){ return Collections.emptyList(); } 69 70 public MirrorKind kind(){ return MirrorKind.ANNOTATION_ELEMENT; } 71 } 72 | Popular Tags |