if (source == null) return null;
List<Object> list = source.getAnnotationOrEvidenceOrCitation();
// Destination type
AnnotationGroup dest = new AnnotationGroup();
// Capture XBELCitation elements of list as a new list
List<XBELCitation> l1 = listCapture(list, XBELCitation.class);
List<Citation> l2 = new ArrayList<Citation>();
CitationConverter cConverter = new CitationConverter();
for (final XBELCitation xc : l1) {
// Defer to CitationConverter
l2.add(cConverter.convert(xc));
}
if (!l2.isEmpty()) {
dest.setCitation(l2.get(0));
}
// Capture XBELAnnotation elements of list as a new list
List<XBELAnnotation> l3 = listCapture(list, XBELAnnotation.class);
List<Annotation> l4 = new ArrayList<Annotation>();
AnnotationConverter aConverter = new AnnotationConverter();
for (final XBELAnnotation xa : l3) {
// Defer to AnnotationConverter
l4.add(aConverter.convert(xa));
}
dest.setAnnotations(l4);
// Capture evidence strings of list as a new list
List<String> l5 = listCapture(list, String.class);
List<Evidence> l6 = new ArrayList<Evidence>();
for (final String str : l5) {
l6.add(CommonModelFactory.getInstance().createEvidence(str));
}
if (!l6.isEmpty()) {
dest.setEvidence(l6.get(0));
}
return dest;
}