&& value instanceof Collection){
// XML choice list
/*
* Step 5.10.2.4.4.1: Is it XML choice list?. If assign find right element name.
*/
XmlElements xmlElms = declaredField.getAnnotation(XmlElements.class);
Collection<?> valueList = (Collection<?>)value;
if(!valueList.isEmpty()){
// use first object to identify type
ArrayList<Map<String,Object>> group = new ArrayList<Map<String,Object>>();
for(Object ob : valueList){
for(XmlElement elm : xmlElms.value()){
// TODO JAXBElement
if(((Class<?>)elm.type()).isAssignableFrom(ob.getClass())){
Map<String,Object> objectMap = new HashMap<String, Object>();
objectMap.put(elm.name(), ob);
group.add(objectMap);
break;// XmlElement list break
}
}
}
hasData = this.add(name, group, null, hasData, property) || hasData;
continue nextProperty;
} else {
// If choice element id empty, don't print it at all
if(!this.metaDataMode){
continue nextProperty;
} else {
name = "CHOICE";
Map<String,Object> choices = new HashMap<String, Object>();
for(XmlElement elm : xmlElms.value()){
try{
choices.put(elm.name(), getMetaDataInstance(elm.type(),null,null));
}catch(Throwable th){
//
choices.put(elm.name(),"object");
}
}
value = choices;
}
}
}else if(declaredField.isAnnotationPresent(XmlElementRefs.class)
&& Collection.class.isAssignableFrom(declaredField.getType())
&& value instanceof Collection){
// XML choice list
/*
* Step 5.10.2.4.4.1: Is it XML choice list?. If assign find right element name.
*/
XmlElementRefs xmlElms = declaredField.getAnnotation(XmlElementRefs.class);
Collection<?> valueList = (Collection<?>)value;
if(!valueList.isEmpty()){
// use first object to identify type
Map<String,List<Object>> group = new HashMap<String,List<Object>>();
for(Object ob : valueList){
for(XmlElementRef elm : xmlElms.value()) {
if(ob instanceof JAXBElement<?>) {
JAXBElement<?> element = (JAXBElement<?>)ob;
if(element.getName().getLocalPart().equals(elm.name())){// namespace too
name = elm.name();
if(!group.containsKey(name))
group.put(name, new ArrayList<Object>());
group.get(name).add(element.getValue());
break;// Break element list
}
} else {
if(((Class<?>)elm.type()).isAssignableFrom(ob.getClass())){
name = elm.name();
if(!group.containsKey(name))
group.put(name, new ArrayList<Object>());
group.get(name).add(ob);
break;// Break element list
}
}
}
}
for(Map.Entry<String, List<Object>> entry : group.entrySet()){
hasData = this.add(entry.getKey(), entry.getValue(), null, hasData, property) || hasData;
// TODO this.setExprStack(expr);
}
continue nextProperty;
} else {
// If choice element id empty, don't print it at all
if(!this.metaDataMode){
continue nextProperty;
} else {
name = "CHOICE";
Map<String,Object> choices = new HashMap<String, Object>();
for(XmlElementRef elm : xmlElms.value()){
try{
choices.put(elm.name(), getMetaDataInstance(elm.type(),null,null));
}catch(Throwable th){
//
choices.put(elm.name(),"object");