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


Java IAnnotation.getMemberValuePairs方法代码示例

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


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

示例1: isSilencedGeneratedAnnotation

import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
private static boolean isSilencedGeneratedAnnotation(IAnnotation annotation) throws JavaModelException {
	if ("javax.annotation.Generated".equals(annotation.getElementName())) {
		IMemberValuePair[] memberValuePairs = annotation.getMemberValuePairs();
		for (IMemberValuePair m : memberValuePairs) {
			if ("value".equals(m.getMemberName()) && IMemberValuePair.K_STRING == m.getValueKind()) {
				if (m.getValue() instanceof String) {
					return SILENCED_CODEGENS.contains(m.getValue());
				} else if (m.getValue() instanceof Object[]) {
					for (Object val : (Object[]) m.getValue()) {
						if (SILENCED_CODEGENS.contains(val)) {
							return true;
						}
					}
				}
			}
		}
	}
	return false;
}
 
开发者ID:angelozerr,项目名称:codelens-eclipse,代码行数:20,代码来源:JDTUtils.java

示例2: isSilencedGeneratedAnnotation

import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
private static boolean isSilencedGeneratedAnnotation(IAnnotation annotation) throws JavaModelException {
	if ("javax.annotation.Generated".equals(annotation.getElementName())) {
		IMemberValuePair[] memberValuePairs = annotation.getMemberValuePairs();
		for (IMemberValuePair m : memberValuePairs) {
			if ("value".equals(m.getMemberName())
					&& IMemberValuePair.K_STRING == m.getValueKind()) {
				if (m.getValue() instanceof String) {
					return SILENCED_CODEGENS.contains(m.getValue());
				} else if (m.getValue() instanceof Object[]) {
					for (Object val : (Object[])m.getValue()) {
						if(SILENCED_CODEGENS.contains(val)) {
							return true;
						}
					}
				}
			}
		}
	}
	return false;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:21,代码来源:JDTUtils.java

示例3: appendAnnotationLabel

import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
public void appendAnnotationLabel(IAnnotation annotation, long flags) throws JavaModelException {
	fBuilder.append('@');
	appendTypeSignatureLabel(annotation, Signature.createTypeSignature(annotation.getElementName(), false), flags);
	IMemberValuePair[] memberValuePairs= annotation.getMemberValuePairs();
	if (memberValuePairs.length == 0) {
		return;
	}
	fBuilder.append('(');
	for (int i= 0; i < memberValuePairs.length; i++) {
		if (i > 0) {
			fBuilder.append(JavaElementLabels.COMMA_STRING);
		}
		IMemberValuePair memberValuePair= memberValuePairs[i];
		fBuilder.append(getMemberName(annotation, annotation.getElementName(), memberValuePair.getMemberName()));
		fBuilder.append('=');
		appendAnnotationValue(annotation, memberValuePair.getValue(), memberValuePair.getValueKind(), flags);
	}
	fBuilder.append(')');
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:20,代码来源:JavaElementLabelComposer.java

示例4: appendAnnotationLabel

import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
public void appendAnnotationLabel(IAnnotation annotation, long flags, StringBuilder builder)
    throws JavaModelException {
  builder.append('@');
  appendTypeSignatureLabel(
      annotation,
      Signature.createTypeSignature(annotation.getElementName(), false),
      flags,
      builder);
  IMemberValuePair[] memberValuePairs = annotation.getMemberValuePairs();
  if (memberValuePairs.length == 0) return;
  builder.append('(');
  for (int i = 0; i < memberValuePairs.length; i++) {
    if (i > 0) builder.append(JavaElementLabels.COMMA_STRING);
    IMemberValuePair memberValuePair = memberValuePairs[i];
    builder.append(
        getMemberName(annotation, annotation.getElementName(), memberValuePair.getMemberName()));
    builder.append('=');
    appendAnnotationValue(
        annotation, memberValuePair.getValue(), memberValuePair.getValueKind(), flags, builder);
  }
  builder.append(')');
}
 
开发者ID:eclipse,项目名称:che,代码行数:23,代码来源:SourcesFromBytecodeGenerator.java

示例5: appendAnnotation

import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
private void appendAnnotation(IAnnotation annotation) throws JavaModelException {
  String name = annotation.getElementName();
  if (!fStubInvisible && name.startsWith("sun.")) // $NON-NLS-1$
  return; // skip Sun-internal annotations

  fBuffer.append('@');
  fBuffer.append(name);
  fBuffer.append('(');

  IMemberValuePair[] memberValuePairs = annotation.getMemberValuePairs();
  for (IMemberValuePair pair : memberValuePairs) {
    fBuffer.append(pair.getMemberName());
    fBuffer.append('=');
    appendAnnotationValue(pair.getValue(), pair.getValueKind());
    fBuffer.append(',');
  }
  if (memberValuePairs.length > 0) fBuffer.deleteCharAt(fBuffer.length() - 1);

  fBuffer.append(')').append('\n');
}
 
开发者ID:eclipse,项目名称:che,代码行数:21,代码来源:StubCreator.java

示例6: appendAnnotationLabel

import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
public void appendAnnotationLabel(IAnnotation annotation, long flags) throws JavaModelException {
  fBuffer.append('@');
  appendTypeSignatureLabel(
      annotation, Signature.createTypeSignature(annotation.getElementName(), false), flags);
  IMemberValuePair[] memberValuePairs = annotation.getMemberValuePairs();
  if (memberValuePairs.length == 0) return;
  fBuffer.append('(');
  for (int i = 0; i < memberValuePairs.length; i++) {
    if (i > 0) fBuffer.append(JavaElementLabels.COMMA_STRING);
    IMemberValuePair memberValuePair = memberValuePairs[i];
    fBuffer.append(
        getMemberName(annotation, annotation.getElementName(), memberValuePair.getMemberName()));
    fBuffer.append('=');
    appendAnnotationValue(
        annotation, memberValuePair.getValue(), memberValuePair.getValueKind(), flags);
  }
  fBuffer.append(')');
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:JavaElementLabelComposer.java

示例7: appendAnnotationLabel

import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
public void appendAnnotationLabel(IAnnotation annotation, long flags) throws JavaModelException {
	fBuffer.append('@');
	appendTypeSignatureLabel(annotation, Signature.createTypeSignature(annotation.getElementName(), false), flags);
	IMemberValuePair[] memberValuePairs= annotation.getMemberValuePairs();
	if (memberValuePairs.length == 0)
		return;
	fBuffer.append('(');
	for (int i= 0; i < memberValuePairs.length; i++) {
		if (i > 0)
			fBuffer.append(COMMA_STRING);
		IMemberValuePair memberValuePair= memberValuePairs[i];
		fBuffer.append(getMemberName(annotation, annotation.getElementName(), memberValuePair.getMemberName()));
		fBuffer.append('=');
		appendAnnotationValue(annotation, memberValuePair.getValue(), memberValuePair.getValueKind(), flags);
	}
	fBuffer.append(')');
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:18,代码来源:JavaElementLabelComposer.java

示例8: sameAnnotationStringValue

import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
private boolean sameAnnotationStringValue(IAnnotation annotation,
		String actionValue) throws JavaModelException {
	boolean res = false;
	if (annotation.exists()) {
		IMemberValuePair[] valuePairs = annotation.getMemberValuePairs();
		for (IMemberValuePair valuePair : valuePairs) {
			res = valuePair.getValueKind() == IMemberValuePair.K_STRING
					&& valuePair.getValue() instanceof String
					&& ANNOTATION_VALUE.equals(valuePair.getMemberName())
					&& actionValue.equals(valuePair.getValue());
			if (res) {
				break;
			}
		}
	}
	return res;
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:18,代码来源:AnnotationParser.java

示例9: appendAnnotation

import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
private void appendAnnotation(IAnnotation annotation) throws JavaModelException {
	String name= annotation.getElementName();
	if (!fStubInvisible && name.startsWith("sun.")) //$NON-NLS-1$
		return; // skip Sun-internal annotations 
	
	fBuffer.append('@');
	fBuffer.append(name);
	fBuffer.append('(');
	
	IMemberValuePair[] memberValuePairs= annotation.getMemberValuePairs();
	for (IMemberValuePair pair : memberValuePairs) {
		fBuffer.append(pair.getMemberName());
		fBuffer.append('=');
		appendAnnotationValue(pair.getValue(), pair.getValueKind());
		fBuffer.append(',');
	}
	if (memberValuePairs.length > 0)
		fBuffer.deleteCharAt(fBuffer.length() - 1);
	
	fBuffer.append(')').append('\n');
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:StubCreator.java

示例10: appendAnnotationLabel

import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
public void appendAnnotationLabel(IAnnotation annotation, long flags) throws JavaModelException {
	fBuffer.append('@');
	appendTypeSignatureLabel(annotation, Signature.createTypeSignature(annotation.getElementName(), false), flags);
	IMemberValuePair[] memberValuePairs= annotation.getMemberValuePairs();
	if (memberValuePairs.length == 0)
		return;
	fBuffer.append('(');
	for (int i= 0; i < memberValuePairs.length; i++) {
		if (i > 0)
			fBuffer.append(JavaElementLabels.COMMA_STRING);
		IMemberValuePair memberValuePair= memberValuePairs[i];
		fBuffer.append(getMemberName(annotation, annotation.getElementName(), memberValuePair.getMemberName()));
		fBuffer.append('=');
		appendAnnotationValue(annotation, memberValuePair.getValue(), memberValuePair.getValueKind(), flags);
	}
	fBuffer.append(')');
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:JavaElementLabelComposer.java

示例11: getAnnotationMemberValue

import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
public static String getAnnotationMemberValue(IAnnotation annotation, String memberName)
{
	try
	{
		IMemberValuePair[] valuePairs = annotation.getMemberValuePairs();
		for (IMemberValuePair valuePair : valuePairs)
		{
			if (memberName.equals(valuePair.getMemberName()))
			{
				return (String)valuePair.getValue();
			}
		}
	}
	catch (JavaModelException e)
	{
		Activator.log(Status.ERROR, "Failed to get member value pairs.", e);
	}
	return null;
}
 
开发者ID:mybatis,项目名称:mybatipse,代码行数:20,代码来源:JavaMapperUtil.java

示例12: matches

import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
@Override
public boolean matches(IMethod method) throws JavaModelException
{
	for (IAnnotation annotation : method.getAnnotations())
	{
		String annotationName = annotation.getElementName();
		if (MybatipseConstants.ANNOTATION_RESULTS.equals(annotationName))
		{
			IMemberValuePair[] valuePairs = annotation.getMemberValuePairs();
			for (IMemberValuePair valuePair : valuePairs)
			{
				if ("id".equals(valuePair.getMemberName()))
				{
					String resultsId = (String)valuePair.getValue();
					return nameMatches(resultsId, matchString, exactMatch);
				}
			}
		}
	}
	return false;
}
 
开发者ID:mybatis,项目名称:mybatipse,代码行数:22,代码来源:JavaMapperUtil.java

示例13: getAliasAnnotationValue

import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
private String getAliasAnnotationValue(IType foundType) throws JavaModelException
{
	String alias = null;
	IAnnotation[] annotations = foundType.getAnnotations();
	for (IAnnotation annotation : annotations)
	{
		if ("Alias".equals(annotation.getElementName()))
		{
			IMemberValuePair[] params = annotation.getMemberValuePairs();
			if (params.length > 0)
			{
				alias = (String)params[0].getValue();
			}
		}
	}
	return alias;
}
 
开发者ID:mybatis,项目名称:mybatipse,代码行数:18,代码来源:TypeAliasCache.java

示例14: appendAnnotation

import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
private void appendAnnotation(IAnnotation annotation) throws JavaModelException {
	fBuffer.append('@');
	fBuffer.append(annotation.getElementName());
	fBuffer.append('(');
	
	IMemberValuePair[] memberValuePairs= annotation.getMemberValuePairs();
	for (IMemberValuePair pair : memberValuePairs) {
		fBuffer.append(pair.getMemberName());
		fBuffer.append('=');
		appendAnnotationValue(pair.getValue(), pair.getValueKind());
		fBuffer.append(',');
	}
	if (memberValuePairs.length > 0)
		fBuffer.deleteCharAt(fBuffer.length() - 1);
	
	fBuffer.append(')').append('\n');
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:18,代码来源:StubCreator.java

示例15: createComponentFromInjection

import org.eclipse.jdt.core.IAnnotation; //导入方法依赖的package包/类
private Component createComponentFromInjection(IType type, final IField field, IAnnotation annotation) throws JavaModelException
{
    Component component = new Component();
    component.setSpecification(this);
    component.setName(field.getElementName());
    component.setNameRange(field.getNameRange());
    component.setJavadocValue(new LazyValue<String>()
    {
        @Override
        protected String eval() throws CoreException
        {
            return JavadocContentAccess2.getHTMLContent(field, true);
        }
    });
    
    for (IMemberValuePair pair : annotation.getMemberValuePairs())
    {
        component.setId(String.valueOf(pair.getValue()));
    }
    
    setComponentDefaults(type, field, component);
    
    return component;
}
 
开发者ID:anjlab,项目名称:eclipse-tapestry5-plugin,代码行数:25,代码来源:TapestryComponentSpecification.java


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