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
1 changed files with 5 additions and 5 deletions

View File

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