private void annotateParameterWithJaxbAnnotations(MemberInfo memInfo, JFieldVar field) {
List<Annotation> jaxbAnnotations = memInfo.getJaxbAnnotations();
for(Annotation ann : jaxbAnnotations) {
if (ann instanceof XmlMimeType) {
JAnnotationUse jaxbAnn = field.annotate(XmlMimeType.class);
jaxbAnn.param("value", ((XmlMimeType)ann).value());
} else if (ann instanceof XmlJavaTypeAdapter) {
JAnnotationUse jaxbAnn = field.annotate(XmlJavaTypeAdapter.class);
XmlJavaTypeAdapter ja = (XmlJavaTypeAdapter) ann;
try {
ja.value();
throw new AssertionError();
} catch (MirroredTypeException e) {
jaxbAnn.param("value",getType(e.getTypeMirror()));
}
// XmlJavaTypeAdapter.type() is for package only. No need to copy.
} else if (ann instanceof XmlAttachmentRef) {
field.annotate(XmlAttachmentRef.class);
} else if (ann instanceof XmlList){
field.annotate(XmlList.class);
} else if (ann instanceof XmlElement) {
XmlElement elemAnn = (XmlElement)ann;
JAnnotationUse jAnn = field.annotate(XmlElement.class);
jAnn.param("name", elemAnn.name());
jAnn.param("namespace", elemAnn.namespace());
if (elemAnn.nillable()) {
jAnn.param("nillable", true);
}
if (elemAnn.required()) {
jAnn.param("required", true);
}
} else {
throw new WebServiceException("SEI Parameter cannot have this JAXB annotation: " + ann);
}
}