void (final AsmCodeGenerator.FormClassVisitor visitor, final String methodName, final String componentClass, final String setMnemonicMethodName) { MethodVisitor mv = visitor.visitNewMethod(ACC_PRIVATE | ACC_SYNTHETIC, methodName, "(L" + componentClass + ";Ljava/lang/String;)V", null, null); mv.visitCode(); mv.visitTypeInsn(NEW, "java/lang/StringBuffer"); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/StringBuffer", "<init>", "()V", false); mv.visitVarInsn(ASTORE, 3); mv.visitInsn(ICONST_0); mv.visitVarInsn(ISTORE, 4); mv.visitInsn(ICONST_0); mv.visitVarInsn(ISTORE, 5); mv.visitInsn(ICONST_M1); mv.visitVarInsn(ISTORE, 6); mv.visitInsn(ICONST_0); mv.visitVarInsn(ISTORE, 7); Label l0 = new Label(); mv.visitLabel(l0); mv.visitVarInsn(ILOAD, 7); mv.visitVarInsn(ALOAD, 2); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "length", "()I", false); Label l1 = new Label(); mv.visitJumpInsn(IF_ICMPGE, l1); mv.visitVarInsn(ALOAD, 2); mv.visitVarInsn(ILOAD, 7); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "charAt", "(I)C", false); mv.visitIntInsn(BIPUSH, 38); Label l2 = new Label(); mv.visitJumpInsn(IF_ICMPNE, l2); mv.visitIincInsn(7, 1); mv.visitVarInsn(ILOAD, 7); mv.visitVarInsn(ALOAD, 2); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "length", "()I", false); Label l3 = new Label(); mv.visitJumpInsn(IF_ICMPNE, l3); mv.visitJumpInsn(GOTO, l1); mv.visitLabel(l3); mv.visitVarInsn(ILOAD, 4); mv.visitJumpInsn(IFNE, l2); mv.visitVarInsn(ALOAD, 2); mv.visitVarInsn(ILOAD, 7); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "charAt", "(I)C", false); mv.visitIntInsn(BIPUSH, 38); mv.visitJumpInsn(IF_ICMPEQ, l2); mv.visitInsn(ICONST_1); mv.visitVarInsn(ISTORE, 4); mv.visitVarInsn(ALOAD, 2); mv.visitVarInsn(ILOAD, 7); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "charAt", "(I)C", false); mv.visitVarInsn(ISTORE, 5); mv.visitVarInsn(ALOAD, 3); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuffer", "length", "()I", false); mv.visitVarInsn(ISTORE, 6); mv.visitLabel(l2); mv.visitVarInsn(ALOAD, 3); mv.visitVarInsn(ALOAD, 2); mv.visitVarInsn(ILOAD, 7); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "charAt", "(I)C", false); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuffer", "append", "(C)Ljava/lang/StringBuffer;", false); mv.visitInsn(POP); mv.visitIincInsn(7, 1); mv.visitJumpInsn(GOTO, l0); mv.visitLabel(l1); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ALOAD, 3); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/StringBuffer", "toString", "()Ljava/lang/String;", false); mv.visitMethodInsn(INVOKEVIRTUAL, componentClass, "setText", "(Ljava/lang/String;)V", false); mv.visitVarInsn(ILOAD, 4); Label l4 = new Label(); mv.visitJumpInsn(IFEQ, l4); mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 5); mv.visitMethodInsn(INVOKEVIRTUAL, componentClass, setMnemonicMethodName, "(C)V", false); if (myHaveSetDisplayedMnemonicIndex) { mv.visitVarInsn(ALOAD, 1); mv.visitVarInsn(ILOAD, 6); mv.visitMethodInsn(INVOKEVIRTUAL, componentClass, "setDisplayedMnemonicIndex", "(I)V", false); } mv.visitLabel(l4); mv.visitInsn(RETURN); mv.visitMaxs(3, 8); mv.visitEnd(); }