本文整理汇总了Java中org.eclipse.jdt.core.dom.AnnotationTypeDeclaration类的典型用法代码示例。如果您正苦于以下问题:Java AnnotationTypeDeclaration类的具体用法?Java AnnotationTypeDeclaration怎么用?Java AnnotationTypeDeclaration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AnnotationTypeDeclaration类属于org.eclipse.jdt.core.dom包,在下文中一共展示了AnnotationTypeDeclaration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: evaluateListRewrite
import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration; //导入依赖的package包/类
private ListRewrite evaluateListRewrite(ASTRewrite rewrite, ASTNode declNode) {
switch (declNode.getNodeType()) {
case ASTNode.METHOD_DECLARATION:
return rewrite.getListRewrite(declNode, MethodDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.FIELD_DECLARATION:
return rewrite.getListRewrite(declNode, FieldDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.VARIABLE_DECLARATION_EXPRESSION:
return rewrite.getListRewrite(declNode, VariableDeclarationExpression.MODIFIERS2_PROPERTY);
case ASTNode.VARIABLE_DECLARATION_STATEMENT:
return rewrite.getListRewrite(declNode, VariableDeclarationStatement.MODIFIERS2_PROPERTY);
case ASTNode.SINGLE_VARIABLE_DECLARATION:
return rewrite.getListRewrite(declNode, SingleVariableDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.TYPE_DECLARATION:
return rewrite.getListRewrite(declNode, TypeDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.ENUM_DECLARATION:
return rewrite.getListRewrite(declNode, EnumDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.ANNOTATION_TYPE_DECLARATION:
return rewrite.getListRewrite(declNode, AnnotationTypeDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.ENUM_CONSTANT_DECLARATION:
return rewrite.getListRewrite(declNode, EnumConstantDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.ANNOTATION_TYPE_MEMBER_DECLARATION:
return rewrite.getListRewrite(declNode, AnnotationTypeMemberDeclaration.MODIFIERS2_PROPERTY);
default:
throw new IllegalArgumentException("node has no modifiers: " + declNode.getClass().getName()); //$NON-NLS-1$
}
}
示例2: visit
import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration; //导入依赖的package包/类
@Override
public boolean visit(AnnotationTypeDeclaration node) {
if (node.getJavadoc() != null) {
node.getJavadoc().accept(this);
}
printModifiers(node.modifiers());
this.fBuffer.append("@interface ");//$NON-NLS-1$
node.getName().accept(this);
this.fBuffer.append(" {");//$NON-NLS-1$
for (Iterator<BodyDeclaration> it= node.bodyDeclarations().iterator(); it.hasNext();) {
BodyDeclaration d= it.next();
d.accept(this);
}
this.fBuffer.append("}");//$NON-NLS-1$
return false;
}
示例3: visit
import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration; //导入依赖的package包/类
public boolean visit(AnnotationTypeDeclaration node) {
if (node.getJavadoc() != null) {
node.getJavadoc().accept(this);
}
printIndent();
printModifiers(node.modifiers());
this.buffer.append("@interface ");//$NON-NLS-1$
node.getName().accept(this);
this.buffer.append(" {");//$NON-NLS-1$
for (Iterator it = node.bodyDeclarations().iterator(); it.hasNext(); ) {
BodyDeclaration d = (BodyDeclaration) it.next();
d.accept(this);
}
this.buffer.append("}\n");//$NON-NLS-1$
return false;
}
示例4: visit
import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration; //导入依赖的package包/类
@Override
public boolean visit(AnnotationTypeDeclaration node) {
AbstractAnnotation absAnnotation = new AbstractAnnotation();
if (packageName != null) {
absAnnotation.setName(packageName+'.'+node.getName().getFullyQualifiedName());
} else {
absAnnotation.setName(node.getName().getFullyQualifiedName());
}
TypeVisitor visitor = new TypeVisitor();
node.accept(visitor);
absAnnotation.setMethods(visitor.getMethods());
absAnnotation.setFields(visitor.getFields());
absAnnotation.setStartPosition(node.getStartPosition());
absAnnotation.setEndPosition(node.getStartPosition() + node.getLength() - 1);
absAnnotation.setMembers(visitor.getAnnotationMembers());
types.add(absAnnotation);
return true;
}
示例5: visit
import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration; //导入依赖的package包/类
@Override
public boolean visit(AnnotationTypeDeclaration node) {
if (++fTypes > 1) {
return false;
}
return super.visit(node);
}
示例6: endVisit
import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration; //导入依赖的package包/类
@Override
public void endVisit(AnnotationTypeDeclaration node) {
if (skipNode(node)) {
return;
}
GenericSequentialFlowInfo info = processSequential(node, node.bodyDeclarations());
info.setNoReturn();
}
示例7: visit
import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration; //导入依赖的package包/类
@Override
public boolean visit(AnnotationTypeDeclaration node) {
// Don't dive into a local type.
if (node.isLocalTypeDeclaration()) {
return false;
}
return true;
}
示例8: getRewrite
import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration; //导入依赖的package包/类
@Override
protected ASTRewrite getRewrite() throws CoreException {
CompilationUnit astRoot= ASTResolving.findParentCompilationUnit(fInvocationNode);
ASTNode typeDecl= astRoot.findDeclaringNode(fSenderBinding);
ASTNode newTypeDecl= null;
if (typeDecl != null) {
newTypeDecl= typeDecl;
} else {
astRoot= ASTResolving.createQuickFixAST(getCompilationUnit(), null);
newTypeDecl= astRoot.findDeclaringNode(fSenderBinding.getKey());
}
createImportRewrite(astRoot);
if (newTypeDecl instanceof AnnotationTypeDeclaration) {
AnnotationTypeDeclaration newAnnotationTypeDecl= (AnnotationTypeDeclaration) newTypeDecl;
ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
AnnotationTypeMemberDeclaration newStub= getStub(rewrite, newAnnotationTypeDecl);
List<BodyDeclaration> members= newAnnotationTypeDecl.bodyDeclarations();
int insertIndex= members.size();
ListRewrite listRewriter= rewrite.getListRewrite(newAnnotationTypeDecl, AnnotationTypeDeclaration.BODY_DECLARATIONS_PROPERTY);
listRewriter.insertAt(newStub, insertIndex, null);
return rewrite;
}
return null;
}
示例9: evaluateModifiers
import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration; //导入依赖的package包/类
private int evaluateModifiers(AnnotationTypeDeclaration targetTypeDecl) {
List<BodyDeclaration> methodDecls= targetTypeDecl.bodyDeclarations();
for (int i= 0; i < methodDecls.size(); i++) {
Object curr= methodDecls.get(i);
if (curr instanceof AnnotationTypeMemberDeclaration) {
return ((AnnotationTypeMemberDeclaration) curr).getModifiers();
}
}
return 0;
}
示例10: evaluateListRewrite
import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration; //导入依赖的package包/类
private ListRewrite evaluateListRewrite(ASTRewrite rewrite, ASTNode declNode) {
switch (declNode.getNodeType()) {
case ASTNode.METHOD_DECLARATION:
return rewrite.getListRewrite(declNode, MethodDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.FIELD_DECLARATION:
return rewrite.getListRewrite(declNode, FieldDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.VARIABLE_DECLARATION_EXPRESSION:
return rewrite.getListRewrite(declNode, VariableDeclarationExpression.MODIFIERS2_PROPERTY);
case ASTNode.VARIABLE_DECLARATION_STATEMENT:
return rewrite.getListRewrite(declNode, VariableDeclarationStatement.MODIFIERS2_PROPERTY);
case ASTNode.SINGLE_VARIABLE_DECLARATION:
return rewrite.getListRewrite(declNode, SingleVariableDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.TYPE_DECLARATION:
return rewrite.getListRewrite(declNode, TypeDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.ENUM_DECLARATION:
return rewrite.getListRewrite(declNode, EnumDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.ANNOTATION_TYPE_DECLARATION:
return rewrite.getListRewrite(declNode, AnnotationTypeDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.ENUM_CONSTANT_DECLARATION:
return rewrite.getListRewrite(declNode, EnumConstantDeclaration.MODIFIERS2_PROPERTY);
case ASTNode.ANNOTATION_TYPE_MEMBER_DECLARATION:
return rewrite.getListRewrite(
declNode, AnnotationTypeMemberDeclaration.MODIFIERS2_PROPERTY);
default:
throw new IllegalArgumentException(
"node has no modifiers: " + declNode.getClass().getName()); // $NON-NLS-1$
}
}
示例11: getRewrite
import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration; //导入依赖的package包/类
@Override
protected ASTRewrite getRewrite() throws CoreException {
CompilationUnit astRoot = ASTResolving.findParentCompilationUnit(fInvocationNode);
ASTNode typeDecl = astRoot.findDeclaringNode(fSenderBinding);
ASTNode newTypeDecl = null;
if (typeDecl != null) {
newTypeDecl = typeDecl;
} else {
astRoot = ASTResolving.createQuickFixAST(getCompilationUnit(), null);
newTypeDecl = astRoot.findDeclaringNode(fSenderBinding.getKey());
}
createImportRewrite(astRoot);
if (newTypeDecl instanceof AnnotationTypeDeclaration) {
AnnotationTypeDeclaration newAnnotationTypeDecl = (AnnotationTypeDeclaration) newTypeDecl;
ASTRewrite rewrite = ASTRewrite.create(astRoot.getAST());
AnnotationTypeMemberDeclaration newStub = getStub(rewrite, newAnnotationTypeDecl);
List<BodyDeclaration> members = newAnnotationTypeDecl.bodyDeclarations();
int insertIndex = members.size();
ListRewrite listRewriter =
rewrite.getListRewrite(
newAnnotationTypeDecl, AnnotationTypeDeclaration.BODY_DECLARATIONS_PROPERTY);
listRewriter.insertAt(newStub, insertIndex, null);
return rewrite;
}
return null;
}
示例12: evaluateModifiers
import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration; //导入依赖的package包/类
private int evaluateModifiers(AnnotationTypeDeclaration targetTypeDecl) {
List<BodyDeclaration> methodDecls = targetTypeDecl.bodyDeclarations();
for (int i = 0; i < methodDecls.size(); i++) {
Object curr = methodDecls.get(i);
if (curr instanceof AnnotationTypeMemberDeclaration) {
return ((AnnotationTypeMemberDeclaration) curr).getModifiers();
}
}
return 0;
}
示例13: visit
import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration; //导入依赖的package包/类
@Override
public boolean visit(AnnotationTypeDeclaration node) {
ITypeBinding binding = node.resolveBinding();
if (binding == null) {
logNullBinding("annotation type declaration", node.getName(), ((CompilationUnit) node.getRoot()).getLineNumber(node.getStartPosition()));
return false;
}
Type type = importer.ensureTypeFromTypeBinding(binding);
type.setIsStub(false);
importer.createSourceAnchor(type, node, (CompilationUnit) node.getRoot());
importer.pushOnContainerStack(type);
importer.ensureCommentFromBodyDeclaration(type, node);
return true;
}
示例14: endVisit
import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration; //导入依赖的package包/类
@Override
public void endVisit(AnnotationTypeDeclaration node) {
if (skipNode(node))
return;
GenericSequentialFlowInfo info= processSequential(node, node.bodyDeclarations());
info.setNoReturn();
}
示例15: visit
import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration; //导入依赖的package包/类
@Override
public boolean visit(AnnotationTypeDeclaration node) {
// Don't dive into a local type.
if (node.isLocalTypeDeclaration())
return false;
return true;
}