String (final Object value, boolean isArray) { final StringBuilder descriptor = new StringBuilder(); descriptor.append("()"); if (isArray) { descriptor.append("["); } if (value instanceof Type) { descriptor.append("Ljava/lang/Class;"); } else { final String name = Type.getType(value.getClass()).getInternalName(); // only primitive, String, Class, Enum, another Annotation or array of any of these are allowed switch (name) { case "java/lang/Integer": descriptor.append("I"); break; case "java/lang/Short": descriptor.append("S"); break; case "java/lang/Long": descriptor.append("J"); break; case "java/lang/Byte": descriptor.append("B"); break; case "java/lang/Char": descriptor.append("C"); break; case "java/lang/Boolean": descriptor.append("Z"); break; case "java/lang/Float": descriptor.append("F"); break; case "java/lang/Double": descriptor.append("D"); break; default: descriptor.append("L").append(name).append(";"); break; } } return descriptor.toString(); }