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