in remoting/server/indexer/usages/src/org/netbeans/modules/jackpot30/indexer/usages/IndexerImpl.java [382:468]
private static void encodeType(Elements elements, final TypeMirror type, final StringBuilder sb) {
switch (type.getKind()) {
case VOID:
sb.append('V'); // NOI18N
break;
case BOOLEAN:
sb.append('Z'); // NOI18N
break;
case BYTE:
sb.append('B'); // NOI18N
break;
case SHORT:
sb.append('S'); // NOI18N
break;
case INT:
sb.append('I'); // NOI18N
break;
case LONG:
sb.append('J'); // NOI18N
break;
case CHAR:
sb.append('C'); // NOI18N
break;
case FLOAT:
sb.append('F'); // NOI18N
break;
case DOUBLE:
sb.append('D'); // NOI18N
break;
case ARRAY:
sb.append('['); // NOI18N
assert type instanceof ArrayType;
encodeType(elements, ((ArrayType)type).getComponentType(),sb);
break;
case DECLARED:
{
sb.append('L'); // NOI18N
DeclaredType dt = (DeclaredType) type;
TypeElement te = (TypeElement) dt.asElement();
sb.append(elements.getBinaryName(te).toString().replace('.', '/'));
if (!dt.getTypeArguments().isEmpty()) {
sb.append('<');
for (TypeMirror tm : dt.getTypeArguments()) {
encodeType(elements, tm, sb);
}
sb.append('>');
}
sb.append(';'); // NOI18N
break;
}
case TYPEVAR:
{
assert type instanceof TypeVariable;
TypeVariable tr = (TypeVariable) type;
sb.append('T');
sb.append(tr.asElement().getSimpleName());
sb.append(';');
break;
}
case WILDCARD: {
WildcardType wt = (WildcardType) type;
if (wt.getExtendsBound() != null) {
sb.append('+');
encodeType(elements, wt.getExtendsBound(), sb);
} else if (wt.getSuperBound() != null) {
sb.append('-');
encodeType(elements, wt.getSuperBound(), sb);
} else {
sb.append('*');
}
break;
}
case ERROR:
{
TypeElement te = (TypeElement) ((ErrorType)type).asElement();
if (te != null) {
sb.append('L');
sb.append(elements.getBinaryName(te).toString().replace('.', '/'));
sb.append(';'); // NOI18N
break;
}
}
default:
throw new IllegalArgumentException (type.getKind().name());
}
}