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


Java TypeConstants.VALUE属性代码示例

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


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

示例1: getRetentionPolicy

private IMemberValuePair[] getRetentionPolicy(long tagBits) {
	if ((tagBits & TagBits.AnnotationRetentionMASK) == 0)
		return Annotation.NO_MEMBER_VALUE_PAIRS;
	String retention = null;
	if ((tagBits & TagBits.AnnotationRuntimeRetention) == TagBits.AnnotationRuntimeRetention) {
		// TagBits.AnnotationRuntimeRetention combines both TagBits.AnnotationClassRetention & TagBits.AnnotationSourceRetention
		retention = new String(CharOperation.concatWith(TypeConstants.JAVA_LANG_ANNOTATION_RETENTIONPOLICY, '.')) + '.' + new String(TypeConstants.UPPER_RUNTIME);
	} else if ((tagBits & TagBits.AnnotationSourceRetention) != 0) {
		retention = new String(CharOperation.concatWith(TypeConstants.JAVA_LANG_ANNOTATION_RETENTIONPOLICY, '.')) + '.' + new String(TypeConstants.UPPER_SOURCE);
	} else {
		retention = new String(CharOperation.concatWith(TypeConstants.JAVA_LANG_ANNOTATION_RETENTIONPOLICY, '.')) + '.' + new String(TypeConstants.UPPER_CLASS);
	}
	final String value = retention;
	return 
		new IMemberValuePair[] {
			new IMemberValuePair() {
				public int getValueKind() {
					return IMemberValuePair.K_QUALIFIED_NAME;
				}
				public Object getValue() {
					return value;
				}
				public String getMemberName() {
					return new String(TypeConstants.VALUE);
				}
			}
		};
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:28,代码来源:ClassFileInfo.java

示例2: getPackedAnnotationBindings

public static AnnotationBinding [] getPackedAnnotationBindings(AnnotationBinding [] annotations) {
	
	int length = annotations == null ? 0 : annotations.length;
	if (length == 0)
		return annotations;
	
	AnnotationBinding[] repackagedBindings = annotations; // only replicate if repackaging.
	for (int i = 0; i < length; i++) {
		AnnotationBinding annotation = repackagedBindings[i];
		if (annotation == null) continue;
		ReferenceBinding annotationType = annotation.getAnnotationType();
		if (!annotationType.isRepeatableAnnotationType())
			continue;
		ReferenceBinding containerType = annotationType.containerAnnotationType();
		if (containerType == null)
			continue; // FUBAR.
		MethodBinding [] values = containerType.getMethods(TypeConstants.VALUE);
		if (values == null || values.length != 1)
			continue; // FUBAR.
		MethodBinding value = values[0];
		if (value.returnType == null || value.returnType.dimensions() != 1 || TypeBinding.notEquals(value.returnType.leafComponentType(), annotationType))
			continue; // FUBAR
		
		// We have a kosher repeatable annotation with a kosher containing type. See if actually repeats.
		List<AnnotationBinding> containees = null;
		for (int j = i + 1; j < length; j++) {
			AnnotationBinding otherAnnotation = repackagedBindings[j];
			if (otherAnnotation == null) continue;
			if (otherAnnotation.getAnnotationType() == annotationType) { //$IDENTITY-COMPARISON$
				if (repackagedBindings == annotations)
					System.arraycopy(repackagedBindings, 0, repackagedBindings = new AnnotationBinding[length], 0, length);
				repackagedBindings[j] = null; // so it is not double packed.
				if (containees == null) {
					containees = new ArrayList<AnnotationBinding>();
					containees.add(annotation);
				}
				containees.add(otherAnnotation);
			}
		}
		if (containees != null) {
			ElementValuePair [] elementValuePairs = new ElementValuePair [] { new ElementValuePair(TypeConstants.VALUE, containees.toArray(), value) };
			repackagedBindings[i] = new AnnotationBinding(containerType, elementValuePairs);
		}
	}
	if (repackagedBindings == annotations)
		return annotations;
	
	int finalTally = 0;
	for (int i = 0; i < length; i++) {
		if (repackagedBindings[i] != null)
			finalTally++;
	}
	annotations = new AnnotationBinding [finalTally];
	for (int i = 0, j = 0; i < length; i++) {
		if (repackagedBindings[i] != null)
			annotations[j++] = repackagedBindings[i];
	}
	return annotations;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:59,代码来源:Factory.java

示例3: getTargetElementTypes

private IMemberValuePair[] getTargetElementTypes(long tagBits) {
	ArrayList values = new ArrayList();
	String elementType = new String(CharOperation.concatWith(TypeConstants.JAVA_LANG_ANNOTATION_ELEMENTTYPE, '.')) + '.';
	if ((tagBits & TagBits.AnnotationForType) != 0) {
		values.add(elementType + new String(TypeConstants.TYPE));
	}
	if ((tagBits & TagBits.AnnotationForField) != 0) {
		values.add(elementType + new String(TypeConstants.UPPER_FIELD));
	}
	if ((tagBits & TagBits.AnnotationForMethod) != 0) {
		values.add(elementType + new String(TypeConstants.UPPER_METHOD));
	}
	if ((tagBits & TagBits.AnnotationForParameter) != 0) {
		values.add(elementType + new String(TypeConstants.UPPER_PARAMETER));
	}
	if ((tagBits & TagBits.AnnotationForConstructor) != 0) {
		values.add(elementType + new String(TypeConstants.UPPER_CONSTRUCTOR));
	}
	if ((tagBits & TagBits.AnnotationForLocalVariable) != 0) {
		values.add(elementType + new String(TypeConstants.UPPER_LOCAL_VARIABLE));
	}
	if ((tagBits & TagBits.AnnotationForAnnotationType) != 0) {
		values.add(elementType + new String(TypeConstants.UPPER_ANNOTATION_TYPE));
	}
	if ((tagBits & TagBits.AnnotationForPackage) != 0) {
		values.add(elementType + new String(TypeConstants.UPPER_PACKAGE));
	}
	final Object value;
	if (values.size() == 0) {
		if ((tagBits & TagBits.AnnotationTarget) != 0)
			value = CharOperation.NO_STRINGS;
		else
			return Annotation.NO_MEMBER_VALUE_PAIRS;
	} else if (values.size() == 1) {
		value = values.get(0);
	} else {
		value = values.toArray(new String[values.size()]);
	}
	return new IMemberValuePair[] {
		new IMemberValuePair() {
			public int getValueKind() {
				return IMemberValuePair.K_QUALIFIED_NAME;
			}
			public Object getValue() {
				return value;
			}
			public String getMemberName() {
				return new String(TypeConstants.VALUE);
			}
		}
	};
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:52,代码来源:ClassFileInfo.java


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