cw.visit(Opcodes.V1_5, Opcodes.ACC_PUBLIC + Opcodes.ACC_SUPER, qualifiedInternalClassName, sig, "org/eclipse/persistence/internal/jaxb/many/MapValue", null);
// Write Field: @... public Map entry
String fieldSig = L + mapType.getInternalName() + "<L" + internalKeyName + ";L" + internalValueName + ";>;";
FieldVisitor fv = cw.visitField(Opcodes.ACC_PUBLIC, "entry", L + mapType.getInternalName() + SEMI_COLON, fieldSig, null);
AnnotationVisitor av = fv.visitAnnotation(Type.getDescriptor(XmlElement.class), true);
if (typeMappingInfo != null) {
Annotation[] annotations = typeMappingInfo.getAnnotations();
if (annotations != null) {
for (int i = 0; i < annotations.length; i++) {
Annotation nextAnnotation = annotations[i];
if (nextAnnotation != null && !(nextAnnotation instanceof XmlElement) && !(nextAnnotation instanceof XmlJavaTypeAdapter)) {
String annotationClassName = nextAnnotation.annotationType().getName();
av = fv.visitAnnotation(L + annotationClassName.replace(DOT_CHR, SLASH_CHR) + SEMI_COLON, true);
for (Method next : nextAnnotation.annotationType().getDeclaredMethods()) {
try {
Object nextValue = next.invoke(nextAnnotation, new Object[] {});
if (nextValue instanceof Class) {
Type nextType = Type.getType(L + ((Class) nextValue).getName().replace(DOT_CHR, SLASH_CHR) + SEMI_COLON);
nextValue = nextType;
}
av.visit(next.getName(), nextValue);
} catch (InvocationTargetException ex) {
// ignore the invocation target exception here.
} catch (IllegalAccessException ex) {
}
}
av.visitEnd();
}
}
}
}
fv.visitEnd();
MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null);
mv.visitVarInsn(Opcodes.ALOAD, 0);
mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "org/eclipse/persistence/internal/jaxb/many/MapValue", "<init>", "()V");
mv.visitInsn(Opcodes.RETURN);
mv.visitMaxs(1, 1);
mv.visitEnd();
// Write: @XmlTransitent public void setItem(???)
String methodSig = "(L" + mapType.getInternalName() + "<L" + internalKeyName + ";L" + internalValueName + ";>;)V";
mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "setItem", "(L" + mapType.getInternalName() + ";)V", methodSig, null);
// TODO: Verify that we really want to put @XmlTranient on setItem
// method
mv.visitAnnotation("Ljavax/xml/bind/annotation/XmlTransient;", true);
Label l0 = new Label();
mv.visitLabel(l0);
mv.visitVarInsn(Opcodes.ALOAD, 0);
mv.visitVarInsn(Opcodes.ALOAD, 1);
mv.visitFieldInsn(Opcodes.PUTFIELD, qualifiedInternalClassName, "entry", L + mapType.getInternalName() + SEMI_COLON);
mv.visitInsn(Opcodes.RETURN);
Label l1 = new Label();
mv.visitLabel(l1);
// Replacement?:LocalVariableTypeTableAttribute cvAttr = new
// LocalVariableTypeTableAttribute();
// mv.visitAttribute(cvAttr);
mv.visitMaxs(2, 2);
mv.visitEnd();
// Write @XmlTransient public ??? getItem()
methodSig = "()L" + mapType.getInternalName() + "<L" + internalKeyName + ";L" + internalValueName + ";>;";
mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "getItem", "()L" + mapType.getInternalName() + SEMI_COLON, methodSig, null);
mv.visitAnnotation("Ljavax/xml/bind/annotation/XmlTransient;", true);
mv.visitVarInsn(Opcodes.ALOAD, 0);
mv.visitFieldInsn(Opcodes.GETFIELD, qualifiedInternalClassName, "entry", L + mapType.getInternalName() + SEMI_COLON);
mv.visitInsn(Opcodes.ARETURN);
mv.visitMaxs(1, 1);
mv.visitEnd();
mv = cw.visitMethod(Opcodes.ACC_PUBLIC + Opcodes.ACC_BRIDGE + Opcodes.ACC_SYNTHETIC, "getItem", "()Ljava/lang/Object;", null, null);
mv.visitVarInsn(Opcodes.ALOAD, 0);
mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, qualifiedInternalClassName, "getItem", "()L" + mapType.getInternalName() + SEMI_COLON);
mv.visitInsn(Opcodes.ARETURN);
mv.visitMaxs(1, 1);
mv.visitEnd();
mv = cw.visitMethod(Opcodes.ACC_PUBLIC + Opcodes.ACC_BRIDGE + Opcodes.ACC_SYNTHETIC, "setItem", "(Ljava/lang/Object;)V", null, null);
mv.visitVarInsn(Opcodes.ALOAD, 0);
mv.visitVarInsn(Opcodes.ALOAD, 1);
mv.visitTypeInsn(Opcodes.CHECKCAST, mapType.getInternalName());
mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, qualifiedInternalClassName, "setItem", "(L" + mapType.getInternalName() + ";)V");
mv.visitInsn(Opcodes.RETURN);
mv.visitMaxs(2, 2);
mv.visitEnd();
// Write @XmlType(namespace)
av = cw.visitAnnotation("Ljavax/xml/bind/annotation/XmlType;", true);
av.visit("namespace", namespace);
cw.visitEnd();
byte[] classBytes = cw.toByteArray();
return generateClassFromBytes(qualifiedClassName, classBytes);