/* */ }
/* */ }
/* */
/* */ private void invokePut(QName qName, TermBinding term, Object owner, Object o)
/* */ {
/* 1127 */ PutMethodMetaData putMethodMetaData = term.getPutMethodMetaData();
/* */
/* 1129 */ MapEntryMetaData mapEntryMetaData = term.getMapEntryMetaData();
/* 1130 */ if (mapEntryMetaData == null)
/* */ {
/* 1132 */ throw new JBossXBRuntimeException((putMethodMetaData == null ? "Parent object is an instance of java.util.Map" : new StringBuilder().append("putMethod is specified for element ").append(qName).toString()) + " but mapEntry is specified for neither element " + qName + " nor it's type.");
/* */ }
/* */
/* 1142 */ Class oClass = o.getClass();
/* 1143 */ String getKeyMethodName = mapEntryMetaData.getGetKeyMethod();
/* 1144 */ if (getKeyMethodName == null)
/* */ {
/* 1146 */ getKeyMethodName = "getKey";
/* */ }
/* */ Method keyMethod;
/* */ try
/* */ {
/* 1152 */ keyMethod = oClass.getMethod(getKeyMethodName, null);
/* */ }
/* */ catch (NoSuchMethodException e)
/* */ {
/* 1156 */ throw new JBossXBRuntimeException("setParent failed for " + qName + "=" + o + ": getKeyMethod=" + getKeyMethodName + " not found in " + oClass);
/* */ }
/* */
/* */ Object key;
/* */ try
/* */ {
/* 1169 */ key = keyMethod.invoke(o, null);
/* */ }
/* */ catch (Exception e)
/* */ {
/* 1173 */ throw new JBossXBRuntimeException("setParent failed for " + qName + "=" + o + ": getKeyMethod=" + getKeyMethodName + " threw an exception: " + e.getMessage(), e);
/* */ }
/* */
/* 1183 */ Class keyType = Object.class;
/* 1184 */ Class valueType = Object.class;
/* 1185 */ String putMethodName = "put";
/* 1186 */ Class ownerClass = owner.getClass();
/* */
/* 1188 */ if (putMethodMetaData != null)
/* */ {
/* 1190 */ if (putMethodMetaData.getKeyType() != null)
/* */ {
/* */ try
/* */ {
/* 1194 */ keyType = Thread.currentThread().getContextClassLoader().loadClass(putMethodMetaData.getKeyType());
/* */ }
/* */ catch (ClassNotFoundException e)
/* */ {
/* 1198 */ throw new JBossXBRuntimeException("setParent failed for " + qName + ": " + e.getMessage(), e);
/* */ }
/* */ }
/* */
/* 1202 */ if (putMethodMetaData.getValueType() != null)
/* */ {
/* */ try
/* */ {
/* 1206 */ valueType = Thread.currentThread().getContextClassLoader().loadClass(putMethodMetaData.getValueType());
/* */ }
/* */ catch (ClassNotFoundException e)
/* */ {
/* 1210 */ throw new JBossXBRuntimeException("setParent failed for " + qName + ": " + e.getMessage(), e);
/* */ }
/* */ }
/* */
/* 1214 */ String name = putMethodMetaData.getName();
/* 1215 */ if (name != null)
/* */ {
/* 1217 */ putMethodName = name;
/* */ }
/* */ }