本文整理汇总了Java中org.eclipse.jdt.core.IMemberValuePair.K_CHAR属性的典型用法代码示例。如果您正苦于以下问题:Java IMemberValuePair.K_CHAR属性的具体用法?Java IMemberValuePair.K_CHAR怎么用?Java IMemberValuePair.K_CHAR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jdt.core.IMemberValuePair
的用法示例。
在下文中一共展示了IMemberValuePair.K_CHAR属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAnnotationMemberValue
public static Object getAnnotationMemberValue(
MemberValuePair memberValuePair, Constant constant) {
if (constant == null) {
memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
return null;
}
switch (constant.typeID()) {
case TypeIds.T_int:
memberValuePair.valueKind = IMemberValuePair.K_INT;
return new Integer(constant.intValue());
case TypeIds.T_byte:
memberValuePair.valueKind = IMemberValuePair.K_BYTE;
return new Byte(constant.byteValue());
case TypeIds.T_short:
memberValuePair.valueKind = IMemberValuePair.K_SHORT;
return new Short(constant.shortValue());
case TypeIds.T_char:
memberValuePair.valueKind = IMemberValuePair.K_CHAR;
return new Character(constant.charValue());
case TypeIds.T_float:
memberValuePair.valueKind = IMemberValuePair.K_FLOAT;
return new Float(constant.floatValue());
case TypeIds.T_double:
memberValuePair.valueKind = IMemberValuePair.K_DOUBLE;
return new Double(constant.doubleValue());
case TypeIds.T_boolean:
memberValuePair.valueKind = IMemberValuePair.K_BOOLEAN;
return Boolean.valueOf(constant.booleanValue());
case TypeIds.T_long:
memberValuePair.valueKind = IMemberValuePair.K_LONG;
return new Long(constant.longValue());
case TypeIds.T_JavaLangString:
memberValuePair.valueKind = IMemberValuePair.K_STRING;
return constant.stringValue();
default:
memberValuePair.valueKind = IMemberValuePair.K_UNKNOWN;
return null;
}
}
示例2: appendAnnotationValue
private void appendAnnotationValue(IAnnotation annotation, Object value, int valueKind, long flags) throws JavaModelException {
// Note: To be bug-compatible with Javadoc from Java 5/6/7, we currently don't escape HTML tags in String-valued annotations.
if (value instanceof Object[]) {
fBuilder.append('{');
Object[] values= (Object[]) value;
for (int j= 0; j < values.length; j++) {
if (j > 0) {
fBuilder.append(JavaElementLabels.COMMA_STRING);
}
value= values[j];
appendAnnotationValue(annotation, value, valueKind, flags);
}
fBuilder.append('}');
} else {
switch (valueKind) {
case IMemberValuePair.K_CLASS:
appendTypeSignatureLabel(annotation, Signature.createTypeSignature((String) value, false), flags);
fBuilder.append(".class"); //$NON-NLS-1$
break;
case IMemberValuePair.K_QUALIFIED_NAME:
String name = (String) value;
int lastDot= name.lastIndexOf('.');
if (lastDot != -1) {
String type= name.substring(0, lastDot);
String field= name.substring(lastDot + 1);
appendTypeSignatureLabel(annotation, Signature.createTypeSignature(type, false), flags);
fBuilder.append('.');
fBuilder.append(getMemberName(annotation, type, field));
break;
}
// case IMemberValuePair.K_SIMPLE_NAME: // can't implement, since parent type is not known
//$FALL-THROUGH$
case IMemberValuePair.K_ANNOTATION:
appendAnnotationLabel((IAnnotation) value, flags);
break;
case IMemberValuePair.K_STRING:
fBuilder.append(ASTNodes.getEscapedStringLiteral((String) value));
break;
case IMemberValuePair.K_CHAR:
fBuilder.append(ASTNodes.getEscapedCharacterLiteral(((Character) value).charValue()));
break;
default:
fBuilder.append(String.valueOf(value));
break;
}
}
}
示例3: appendAnnotationValue
private void appendAnnotationValue(
IAnnotation annotation, Object value, int valueKind, long flags, StringBuilder builder)
throws JavaModelException {
// Note: To be bug-compatible with Javadoc from Java 5/6/7, we currently don't escape HTML tags
// in String-valued annotations.
if (value instanceof Object[]) {
builder.append('{');
Object[] values = (Object[]) value;
for (int j = 0; j < values.length; j++) {
if (j > 0) builder.append(JavaElementLabels.COMMA_STRING);
value = values[j];
appendAnnotationValue(annotation, value, valueKind, flags, builder);
}
builder.append('}');
} else {
switch (valueKind) {
case IMemberValuePair.K_CLASS:
appendTypeSignatureLabel(
annotation, Signature.createTypeSignature((String) value, false), flags, builder);
builder.append(".class"); // $NON-NLS-1$
break;
case IMemberValuePair.K_QUALIFIED_NAME:
String name = (String) value;
int lastDot = name.lastIndexOf('.');
if (lastDot != -1) {
String type = name.substring(0, lastDot);
String field = name.substring(lastDot + 1);
appendTypeSignatureLabel(
annotation, Signature.createTypeSignature(type, false), flags, builder);
builder.append('.');
builder.append(getMemberName(annotation, type, field));
break;
}
// case IMemberValuePair.K_SIMPLE_NAME: // can't implement, since parent type is not
// known
// $FALL-THROUGH$
case IMemberValuePair.K_ANNOTATION:
appendAnnotationLabel((IAnnotation) value, flags, builder);
break;
case IMemberValuePair.K_STRING:
builder.append(ASTNodes.getEscapedStringLiteral((String) value));
break;
case IMemberValuePair.K_CHAR:
builder.append(ASTNodes.getEscapedCharacterLiteral(((Character) value).charValue()));
break;
default:
builder.append(String.valueOf(value));
break;
}
}
}
示例4: appendAnnotationValue
private void appendAnnotationValue(
IAnnotation annotation, Object value, int valueKind, long flags) throws JavaModelException {
// Note: To be bug-compatible with Javadoc from Java 5/6/7, we currently don't escape HTML tags
// in String-valued annotations.
if (value instanceof Object[]) {
fBuffer.append('{');
Object[] values = (Object[]) value;
for (int j = 0; j < values.length; j++) {
if (j > 0) fBuffer.append(JavaElementLabels.COMMA_STRING);
value = values[j];
appendAnnotationValue(annotation, value, valueKind, flags);
}
fBuffer.append('}');
} else {
switch (valueKind) {
case IMemberValuePair.K_CLASS:
appendTypeSignatureLabel(
annotation, Signature.createTypeSignature((String) value, false), flags);
fBuffer.append(".class"); // $NON-NLS-1$
break;
case IMemberValuePair.K_QUALIFIED_NAME:
String name = (String) value;
int lastDot = name.lastIndexOf('.');
if (lastDot != -1) {
String type = name.substring(0, lastDot);
String field = name.substring(lastDot + 1);
appendTypeSignatureLabel(annotation, Signature.createTypeSignature(type, false), flags);
fBuffer.append('.');
fBuffer.append(getMemberName(annotation, type, field));
break;
}
// case IMemberValuePair.K_SIMPLE_NAME: // can't implement, since parent type is not
// known
// $FALL-THROUGH$
case IMemberValuePair.K_ANNOTATION:
appendAnnotationLabel((IAnnotation) value, flags);
break;
case IMemberValuePair.K_STRING:
fBuffer.append(ASTNodes.getEscapedStringLiteral((String) value));
break;
case IMemberValuePair.K_CHAR:
fBuffer.append(ASTNodes.getEscapedCharacterLiteral(((Character) value).charValue()));
break;
default:
fBuffer.append(String.valueOf(value));
break;
}
}
}
示例5: appendAnnotationValue
private void appendAnnotationValue(IAnnotation annotation, Object value, int valueKind, long flags) throws JavaModelException {
// Note: To be bug-compatible with Javadoc from Java 5/6/7, we currently don't escape HTML tags in String-valued annotations.
if (value instanceof Object[]) {
fBuffer.append('{');
Object[] values= (Object[]) value;
for (int j= 0; j < values.length; j++) {
if (j > 0)
fBuffer.append(COMMA_STRING);
value= values[j];
appendAnnotationValue(annotation, value, valueKind, flags);
}
fBuffer.append('}');
} else {
switch (valueKind) {
case IMemberValuePair.K_CLASS:
appendTypeSignatureLabel(annotation, Signature.createTypeSignature((String) value, false), flags);
fBuffer.append(".class"); //$NON-NLS-1$
break;
case IMemberValuePair.K_QUALIFIED_NAME:
String name = (String) value;
int lastDot= name.lastIndexOf('.');
if (lastDot != -1) {
String type= name.substring(0, lastDot);
String field= name.substring(lastDot + 1);
appendTypeSignatureLabel(annotation, Signature.createTypeSignature(type, false), flags);
fBuffer.append('.');
fBuffer.append(getMemberName(annotation, type, field));
break;
}
// case IMemberValuePair.K_SIMPLE_NAME: // can't implement, since parent type is not known
//$FALL-THROUGH$
case IMemberValuePair.K_ANNOTATION:
appendAnnotationLabel((IAnnotation) value, flags);
break;
case IMemberValuePair.K_STRING:
fBuffer.append(getEscapedStringLiteral((String) value));
break;
case IMemberValuePair.K_CHAR:
fBuffer.append(getEscapedCharacterLiteral(((Character) value).charValue()));
break;
default:
fBuffer.append(String.valueOf(value));
break;
}
}
}
示例6: appendAnnotationValue
private void appendAnnotationValue(IAnnotation annotation, Object value, int valueKind, long flags) throws JavaModelException {
// Note: To be bug-compatible with Javadoc from Java 5/6/7, we currently don't escape HTML tags in String-valued annotations.
if (value instanceof Object[]) {
fBuffer.append('{');
Object[] values= (Object[]) value;
for (int j= 0; j < values.length; j++) {
if (j > 0)
fBuffer.append(JavaElementLabels.COMMA_STRING);
value= values[j];
appendAnnotationValue(annotation, value, valueKind, flags);
}
fBuffer.append('}');
} else {
switch (valueKind) {
case IMemberValuePair.K_CLASS:
appendTypeSignatureLabel(annotation, Signature.createTypeSignature((String) value, false), flags);
fBuffer.append(".class"); //$NON-NLS-1$
break;
case IMemberValuePair.K_QUALIFIED_NAME:
String name = (String) value;
int lastDot= name.lastIndexOf('.');
if (lastDot != -1) {
String type= name.substring(0, lastDot);
String field= name.substring(lastDot + 1);
appendTypeSignatureLabel(annotation, Signature.createTypeSignature(type, false), flags);
fBuffer.append('.');
fBuffer.append(getMemberName(annotation, type, field));
break;
}
// case IMemberValuePair.K_SIMPLE_NAME: // can't implement, since parent type is not known
//$FALL-THROUGH$
case IMemberValuePair.K_ANNOTATION:
appendAnnotationLabel((IAnnotation) value, flags);
break;
case IMemberValuePair.K_STRING:
fBuffer.append(ASTNodes.getEscapedStringLiteral((String) value));
break;
case IMemberValuePair.K_CHAR:
fBuffer.append(ASTNodes.getEscapedCharacterLiteral(((Character) value).charValue()));
break;
default:
fBuffer.append(String.valueOf(value));
break;
}
}
}