本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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());
}
示例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;
}
示例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);
}
}
}
}
}
示例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;
}