| 230 | | |
|---|
| 231 | | // nasty workaround for Collections |
|---|
| 232 | | // needs to be fixed |
|---|
| 233 | | if (methodName.equals("add")) { |
|---|
| | 230 | |
|---|
| | 231 | // Check, whether the current instance is a Properties object |
|---|
| | 232 | if (Class.forName("java.util.Properties").isAssignableFrom(instance.getClass())) { |
|---|
| | 233 | String key = (String)child.getKey(); |
|---|
| | 234 | Class childParamTypes[] = {Class.forName("java.lang.String"), Class.forName("java.lang.String")}; |
|---|
| | 235 | Method childMethod = cl.getMethod("setProperty", childParamTypes); |
|---|
| | 236 | String params[] = {key, (String)childValue}; |
|---|
| | 237 | childMethod.invoke(instance, params); |
|---|
| | 238 | |
|---|
| | 239 | // Check, whether the current instance is a HashMap |
|---|
| | 240 | } else if (Class.forName("java.util.AbstractMap").isAssignableFrom(instance.getClass())) { |
|---|
| | 241 | Object name = (Object)child.getKey(); |
|---|
| | 242 | Class childParamTypes[] = {Class.forName("java.lang.Object"), Class.forName("java.lang.Object")}; |
|---|
| | 243 | Method childMethod = cl.getMethod("put", childParamTypes); |
|---|
| | 244 | |
|---|
| | 245 | Object params[] = {name, childValue}; |
|---|
| | 246 | childMethod.invoke(instance, params); |
|---|
| | 247 | |
|---|
| | 248 | } else if (methodName.equals("add")) { |
|---|
| | 249 | // nasty workaround for Collections |
|---|
| | 250 | // needs to be fixed |
|---|