当前位置: 首页>>代码示例>>Java>>正文


Java AnnotationTypeMemberDeclaration类代码示例

本文整理汇总了Java中org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration的典型用法代码示例。如果您正苦于以下问题:Java AnnotationTypeMemberDeclaration类的具体用法?Java AnnotationTypeMemberDeclaration怎么用?Java AnnotationTypeMemberDeclaration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AnnotationTypeMemberDeclaration类属于org.eclipse.jdt.core.dom包,在下文中一共展示了AnnotationTypeMemberDeclaration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNodeStartPosition

import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration; //导入依赖的package包/类
private static int getNodeStartPosition(final ASTNode node) {
    if (node instanceof MethodDeclaration) {
        MethodDeclaration decl = (MethodDeclaration) node;
        return decl.isConstructor() ? decl.getName().getStartPosition() : decl.getReturnType2().getStartPosition();
    } else if (node instanceof FieldDeclaration) {
        return ((FieldDeclaration) node).getType().getStartPosition();
    } else if (node instanceof AbstractTypeDeclaration) {
        return ((AbstractTypeDeclaration) node).getName().getStartPosition();
    } else if (node instanceof AnnotationTypeMemberDeclaration) {
        return ((AnnotationTypeMemberDeclaration) node).getName().getStartPosition();
    } else if (node instanceof EnumConstantDeclaration) {
        return ((EnumConstantDeclaration) node).getName().getStartPosition();
    } else if (node instanceof PackageDeclaration) {
        return ((PackageDeclaration) node).getName().getStartPosition();
    }
    /* TODO: Initializer */

    return node.getStartPosition();
}
 
开发者ID:boalang,项目名称:compiler,代码行数:20,代码来源:UglyMathCommentsExtractor.java

示例2: evaluateListRewrite

import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration; //导入依赖的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$
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:ModifierRewrite.java

示例3: visit

import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration; //导入依赖的package包/类
@Override
public boolean visit(AnnotationTypeMemberDeclaration node) {
	if (node.getJavadoc() != null) {
		node.getJavadoc().accept(this);
	}
	printModifiers(node.modifiers());
	node.getType().accept(this);
	this.fBuffer.append(" ");//$NON-NLS-1$
	node.getName().accept(this);
	this.fBuffer.append("()");//$NON-NLS-1$
	if (node.getDefault() != null) {
		this.fBuffer.append(" default ");//$NON-NLS-1$
		node.getDefault().accept(this);
	}
	this.fBuffer.append(";");//$NON-NLS-1$
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:18,代码来源:ASTFlattener.java

示例4: visit

import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration; //导入依赖的package包/类
public boolean visit(AnnotationTypeMemberDeclaration node) {
	if (node.getJavadoc() != null) {
		node.getJavadoc().accept(this);
	}
	printIndent();
	printModifiers(node.modifiers());
	node.getType().accept(this);
	this.buffer.append(" ");//$NON-NLS-1$
	node.getName().accept(this);
	this.buffer.append("()");//$NON-NLS-1$
	if (node.getDefault() != null) {
		this.buffer.append(" default ");//$NON-NLS-1$
		node.getDefault().accept(this);
	}
	this.buffer.append(";\n");//$NON-NLS-1$
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:18,代码来源:NaiveASTFlattener.java

示例5: endVisit

import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration; //导入依赖的package包/类
@Override
public void endVisit(AnnotationTypeMemberDeclaration node) {
	if (skipNode(node)) {
		return;
	}
	GenericSequentialFlowInfo info = processSequential(node, node.getType(), node.getDefault());
	info.setNoReturn();
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:9,代码来源:FlowAnalyzer.java

示例6: getRewrite

import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration; //导入依赖的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;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:31,代码来源:NewAnnotationMemberProposal.java

示例7: evaluateModifiers

import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration; //导入依赖的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;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:11,代码来源:NewAnnotationMemberProposal.java

示例8: evaluateListRewrite

import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration; //导入依赖的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$
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:29,代码来源:ModifierRewrite.java

示例9: resolveInVariableInitializer

import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration; //导入依赖的package包/类
public boolean resolveInVariableInitializer() {
  if (fInVariableInitializerRequested) return fInVariableInitializer;
  fInVariableInitializerRequested = true;
  resolveSelectedNodes();
  ASTNode node = getStartNode();
  ASTNode last = null;
  while (node != null) {
    int nodeType = node.getNodeType();
    if (node instanceof AbstractTypeDeclaration) {
      fInVariableInitializer = false;
      break;
    } else if (nodeType == ASTNode.ANONYMOUS_CLASS_DECLARATION) {
      fInVariableInitializer = false;
      break;
    } else if (nodeType == ASTNode.VARIABLE_DECLARATION_FRAGMENT
        && ((VariableDeclarationFragment) node).getInitializer() == last) {
      fInVariableInitializer = true;
      break;
    } else if (nodeType == ASTNode.SINGLE_VARIABLE_DECLARATION
        && ((SingleVariableDeclaration) node).getInitializer() == last) {
      fInVariableInitializer = true;
      break;
    } else if (nodeType == ASTNode.ANNOTATION_TYPE_MEMBER_DECLARATION
        && ((AnnotationTypeMemberDeclaration) node).getDefault() == last) {
      fInVariableInitializer = true;
      break;
    }
    last = node;
    node = node.getParent();
  }
  return fInVariableInitializer;
}
 
开发者ID:eclipse,项目名称:che,代码行数:33,代码来源:JavaTextSelection.java

示例10: getRewrite

import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration; //导入依赖的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;
}
 
开发者ID:eclipse,项目名称:che,代码行数:33,代码来源:NewAnnotationMemberProposal.java

示例11: evaluateModifiers

import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration; //导入依赖的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;
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:NewAnnotationMemberProposal.java

示例12: visit

import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration; //导入依赖的package包/类
@Override
public boolean visit(AnnotationTypeMemberDeclaration node) {
	AnnotationTypeAttribute attribute = importer.ensureAnnotationTypeAttributeFromDeclaration(node);
	attribute.setIsStub(false);
	importer.ensureCommentFromBodyDeclaration(attribute, node);
	return super.visit(node);
}
 
开发者ID:feenkcom,项目名称:jdt2famix,代码行数:8,代码来源:AstVisitor.java

示例13: ensureAnnotationTypeAttributeFromDeclaration

import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration; //导入依赖的package包/类
public AnnotationTypeAttribute ensureAnnotationTypeAttributeFromDeclaration(
		AnnotationTypeMemberDeclaration node) {
	IMethodBinding binding = node.resolveBinding();
	if (binding != null)
		return ensureAnnotationTypeAttributeFromBinding(binding);
	return new AnnotationTypeAttribute();
}
 
开发者ID:feenkcom,项目名称:jdt2famix,代码行数:8,代码来源:InJavaImporter.java

示例14: endVisit

import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration; //导入依赖的package包/类
@Override
public void endVisit(AnnotationTypeMemberDeclaration node) {
	if (skipNode(node))
		return;
	GenericSequentialFlowInfo info= processSequential(node, node.getType(), node.getDefault());
	info.setNoReturn();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:FlowAnalyzer.java

示例15: resolveInVariableInitializer

import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration; //导入依赖的package包/类
public boolean resolveInVariableInitializer() {
	if (fInVariableInitializerRequested)
		return fInVariableInitializer;
	fInVariableInitializerRequested= true;
	resolveSelectedNodes();
	ASTNode node= getStartNode();
	ASTNode last= null;
	while (node != null) {
		int nodeType= node.getNodeType();
		if (node instanceof AbstractTypeDeclaration) {
			fInVariableInitializer= false;
			break;
		} else if (nodeType == ASTNode.ANONYMOUS_CLASS_DECLARATION) {
			fInVariableInitializer= false;
			break;
		} else if (nodeType == ASTNode.VARIABLE_DECLARATION_FRAGMENT &&
				   ((VariableDeclarationFragment)node).getInitializer() == last) {
			fInVariableInitializer= true;
			break;
		} else if (nodeType == ASTNode.SINGLE_VARIABLE_DECLARATION &&
			       ((SingleVariableDeclaration)node).getInitializer() == last) {
			fInVariableInitializer= true;
			break;
		} else if (nodeType == ASTNode.ANNOTATION_TYPE_MEMBER_DECLARATION &&
			       ((AnnotationTypeMemberDeclaration)node).getDefault() == last) {
			fInVariableInitializer= true;
			break;
		}
		last= node;
		node= node.getParent();
	}
	return fInVariableInitializer;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:34,代码来源:JavaTextSelection.java


注:本文中的org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。