String propTypeSignature,
boolean isElement,
boolean isNillable,
String xmlAdapterClassSignature,
List<Annotation> jaxbAnnotations) {
FieldVisitor fv;
AnnotationVisitor av0;
fv = cw.visitField(ACC_PROTECTED, getFieldName(propName), propClassSignature, propTypeSignature, null);
// For Map property, we cannot have the XmlElement annotation
if (isElement && xmlAdapterClassSignature == null) {
av0 = fv.visitAnnotation("Ljavax/xml/bind/annotation/XmlElement;", true);
av0.visit("name", propName);
av0.visit("namespace", "");
if (isNillable) {
av0.visit("nillable", Boolean.TRUE);
}
// FIXME:
// av0.visit("required", Boolean.FALSE);
av0.visitEnd();
}
if (xmlAdapterClassSignature != null) {
av0 = fv.visitAnnotation("Ljavax/xml/bind/annotation/XmlAnyElement;", true);
av0.visit("lax", Boolean.TRUE);
av0.visitEnd();
av0 = fv.visitAnnotation("Ljavax/xml/bind/annotation/adapters/XmlJavaTypeAdapter;", true);
av0.visit("value", org.objectweb.asm.Type.getType(xmlAdapterClassSignature));
av0.visitEnd();
}
for (Annotation ann : jaxbAnnotations) {
if (ann instanceof XmlMimeType) {
AnnotationVisitor mime = fv.visitAnnotation("Ljavax/xml/bind/annotation/XmlMimeType;", true);
mime.visit("value", ((XmlMimeType)ann).value());
mime.visitEnd();
} else if (ann instanceof XmlJavaTypeAdapter) {
AnnotationVisitor ada = fv.visitAnnotation("Ljavax/xml/bind/annotation/adapters/XmlJavaTypeAdapter;", true);
ada.visit("value", org.objectweb.asm.Type.getType(((XmlJavaTypeAdapter)ann).value()));
ada.visit("type", org.objectweb.asm.Type.getType(((XmlJavaTypeAdapter)ann).type()));
ada.visitEnd();
} else if (ann instanceof XmlAttachmentRef) {
AnnotationVisitor att = fv.visitAnnotation("Ljavax/xml/bind/annotation/XmlAttachmentRef;", true);
att.visitEnd();
} else if (ann instanceof XmlList) {
AnnotationVisitor list = fv.visitAnnotation("Ljavax/xml/bind/annotation/XmlList;", true);
list.visitEnd();
}
}
fv.visitEnd();
}