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


Java IMemberValuePair.getValueKind方法代码示例

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


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

示例1: isSilencedGeneratedAnnotation

import org.eclipse.jdt.core.IMemberValuePair; //导入方法依赖的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.IMemberValuePair; //导入方法依赖的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: sameAnnotationStringValue

import org.eclipse.jdt.core.IMemberValuePair; //导入方法依赖的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

示例4: fromAnnotation

import org.eclipse.jdt.core.IMemberValuePair; //导入方法依赖的package包/类
private static Requirement fromAnnotation(
    IAnnotation requiredAnnotation, MajorVersion majorVersion) {
  if (!requiredAnnotation.exists()) {
    return new Requirement(false, Collections.<String>emptySet());
  }
  IMemberValuePair[] memberValuePairs;
  try {
    memberValuePairs = requiredAnnotation.getMemberValuePairs();
  } catch (JavaModelException e) {
    DataflowCorePlugin.logError(e, "Error while retrieving Member Value Pairs for"
        + " Validation.Required annotation %s in Java Element %s", requiredAnnotation,
        requiredAnnotation.getParent());
    return new Requirement(true, Collections.<String>emptySet());
  }
  for (IMemberValuePair memberValuePair : memberValuePairs) {
    String memberName = memberValuePair.getMemberName();
    Object memberValueObj = memberValuePair.getValue();
    if (memberName.equals(PipelineOptionsNamespaces.validationRequiredGroupField(majorVersion))
        && memberValueObj instanceof Object[]
        && memberValuePair.getValueKind() == IMemberValuePair.K_STRING) {
      Set<String> groups = new HashSet<>();
      for (Object group : (Object[]) memberValueObj) {
        groups.add(group.toString());
      }
      return new Requirement(true, groups);
    }
  }
  return new Requirement(true, Collections.<String>emptySet());
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:30,代码来源:PipelineOptionsProperty.java

示例5: fetchAnnotationStringValue

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

示例6: readValueFromAnnotation

import org.eclipse.jdt.core.IMemberValuePair; //导入方法依赖的package包/类
public static void readValueFromAnnotation(
        IAnnotation annotation, String memberName, IProject project, AST ast,
        ObjectCallback<String, JavaModelException> callback)
                throws JavaModelException
{
    if (annotation == null)
    {
        return;
    }
    
    IMemberValuePair[] pairs = annotation.getMemberValuePairs();
    
    for (IMemberValuePair pair : pairs)
    {
        if (memberName.equals(pair.getMemberName()))
        {
            if (pair.getValueKind() == IMemberValuePair.K_UNKNOWN)
            {
                //  The value is unknown at this stage
                continue;
            }
            else
            {
                Object[] values = pair.getValue().getClass().isArray()
                        ? (Object[]) pair.getValue()
                        : new Object[] { pair.getValue() };
       
               for (Object value : values)
               {
                   String eval = eval(value, pair.getValueKind(), ast, project);
                   
                   callback.callback(eval);
               }
            }
        }
    }
}
 
开发者ID:anjlab,项目名称:eclipse-tapestry5-plugin,代码行数:38,代码来源:EclipseUtils.java

示例7: fetchActionAnnotationValue

import org.eclipse.jdt.core.IMemberValuePair; //导入方法依赖的package包/类
private List<IAnnotation> fetchActionAnnotationValue(
		IAnnotatable annotatable, boolean actionsImportExist,
		boolean actionImportExist) throws JavaModelException {
	List<IAnnotation> result = new ArrayList<IAnnotation>();

	IAnnotation[] annotations = annotatable.getAnnotations();
	for (IAnnotation annotation : annotations) {
		if (annotation.exists()) {
			boolean fetchValue = ACTIONS_ANNOTATION_FQN.equals(annotation
					.getElementName())
					|| (ACTIONS_ANNOTATION.equals(annotation
							.getElementName()) && actionsImportExist);

			if (fetchValue) {
				IMemberValuePair[] valuePairs = annotation
						.getMemberValuePairs();
				for (IMemberValuePair valuePair : valuePairs) {
					if (valuePair.getValueKind() == IMemberValuePair.K_ANNOTATION
							&& ANNOTATION_VALUE.equals(valuePair
									.getMemberName())) {
						// single value
						if (valuePair.getValue() instanceof IAnnotation) {
							result.add((IAnnotation) valuePair.getValue());
						} else {
							// array
							Object[] objs = (Object[]) valuePair.getValue();
							for (Object o : objs) {
								result.add((IAnnotation) o);
							}
						}
					}
				}
			} else {
				fetchValue = ACTION_ANNOTATION_FQN.equals(annotation
						.getElementName())
						|| (ACTION_ANNOTATION.equals(annotation
								.getElementName()) && actionImportExist);
				if (fetchValue) {
					result.add(annotation);
				}
			}
		}
	}

	return result;
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:47,代码来源:AnnotationParser.java


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