/* */ try
/* */ {
/* 204 */ if (!(o instanceof Collection))
/* */ {
/* 206 */ ElementToFieldMapping fieldMapping = (ElementToFieldMapping)this.elementToFieldMapping.get(new ElementToFieldMappingKey(localName, o.getClass()));
/* */ FieldInfo fieldInfo;
/* */ FieldInfo fieldInfo;
/* 211 */ if (fieldMapping != null)
/* */ {
/* 213 */ fieldInfo = fieldMapping.fieldInfo;
/* */ }
/* */ else
/* */ {
/* 217 */ String fieldName = Util.xmlNameToFieldName(localName, true);
/* 218 */ fieldInfo = FieldInfo.getFieldInfo(o.getClass(), fieldName, true);
/* */ }
/* */
/* 221 */ child = get(o, localName, fieldInfo);
/* */ }
/* */
/* 224 */ if (child == null)
/* */ {
/* 226 */ child = newInstance(mapping.cls);
/* */ }
/* */
/* 229 */ if (attrs != null)
/* */ {
/* 231 */ for (int i = 0; i < attrs.getLength(); i++)
/* */ {
/* 233 */ if (attrs.getLocalName(i).length() <= 0)
/* */ continue;
/* 235 */ if (attrs.getQName(i).startsWith("xsi:"))
/* */ continue;
/* 237 */ setAttribute(child, attrs.getLocalName(i), attrs.getValue(i), ctx);
/* */ }
/* */
/* */ }
/* */
/* */ }
/* */ catch (RuntimeException e)
/* */ {
/* 245 */ throw e;
/* */ }
/* */ catch (Exception e)
/* */ {
/* 249 */ throw new NestedRuntimeException("newChild failed for o=" + o + ", uri=" + namespaceURI + ", local=" + localName + ", attrs=" + attrs, e);
/* */ }
/* */
/* */ }
/* 260 */ else if ((o instanceof Collection))
/* */ {
/* 262 */ child = create(namespaceURI, localName, type);
/* */ }
/* */ else
/* */ {
/* */ Class oCls;
/* */ Class oCls;
/* 267 */ if ((o instanceof Immutable))
/* */ {
/* 269 */ oCls = ((Immutable)o).cls;
/* */ }
/* */ else
/* */ {
/* 273 */ oCls = o.getClass();
/* */ }
/* */
/* 276 */ String fieldName = Util.xmlNameToFieldName(localName, true);
/* 277 */ FieldInfo fieldInfo = FieldInfo.getFieldInfo(oCls, fieldName, true);
/* 278 */ if (Collection.class.isAssignableFrom(fieldInfo.getType()))
/* */ {
/* 280 */ child = get(o, localName, fieldInfo);
/* */
/* 284 */ Object item = null;
/* 285 */ if ((type == null) || ((type != null) && (type.getTypeCategory() == 15)))
/* */ {
/* 287 */ item = create(namespaceURI, localName, type);
/* */ }
/* */
/* 290 */ if (item != null)
/* */ {
/* 292 */ if (child == null)
/* */ {
/* 294 */ setChild(new ArrayList(), o, localName);
/* */ }
/* 296 */ child = item;
/* */ }
/* 300 */ else if (child == null)
/* */ {
/* 302 */ child = new ArrayList();
/* */ }
/* */
/* */ }
/* 306 */ else if (!Util.isAttributeType(fieldInfo.getType()))
/* */ {
/* 309 */ ElementToFieldMapping fieldMapping = (ElementToFieldMapping)this.elementToFieldMapping.get(new ElementToFieldMappingKey(localName, o.getClass()));
/* */
/* 312 */ TypeBinding converter = fieldMapping == null ? null : fieldMapping.converter;
/* */
/* 315 */ if (converter == null)
/* */ {
/* 317 */ child = newInstance(fieldInfo.getType());
/* */ }
/* */ }
/* */
/* */ }
/* */