1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-02 06:45:59 +01:00

Remove java.beans dependency

The java.beans package is not available on all platforms (e.g. Android).
This commit is contained in:
Florian Schmaus 2014-03-11 18:21:51 +01:00
parent d655e130ca
commit b9f07046d3

View file

@ -16,7 +16,6 @@
*/
package org.jivesoftware.smack.util;
import java.beans.PropertyDescriptor;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
@ -832,14 +831,15 @@ public class PacketParserUtils {
if (eventType == XmlPullParser.START_TAG) {
String name = parser.getName();
String stringValue = parser.nextText();
PropertyDescriptor descriptor = new PropertyDescriptor(name, objectClass);
// Load the class type of the property.
Class<?> propertyType = descriptor.getPropertyType();
Class<?> propertyType = object.getClass().getMethod(
"get" + Character.toUpperCase(name.charAt(0)) + name.substring(1)).getReturnType();
// Get the value of the property by converting it from a
// String to the correct object type.
Object value = decode(propertyType, stringValue);
// Set the value of the bean.
descriptor.getWriteMethod().invoke(object, value);
object.getClass().getMethod(
"set" + Character.toUpperCase(name.charAt(0)) + name.substring(1),
propertyType).invoke(object, value);
}
else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals(elementName)) {