mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-22 17:18:47 +01:00
Added debug
This commit is contained in:
parent
522675a823
commit
19b7d24ad4
@ -660,7 +660,8 @@ public class MySQLDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
|
|||||||
((Set<Object>) value).add(deserialize(collectionResultSet.getObject(1),Class.forName(setType.getTypeName())));
|
((Set<Object>) value).add(deserialize(collectionResultSet.getObject(1),Class.forName(setType.getTypeName())));
|
||||||
}
|
}
|
||||||
} else if (propertyDescriptor.getPropertyType().equals(ArrayList.class)) {
|
} else if (propertyDescriptor.getPropertyType().equals(ArrayList.class)) {
|
||||||
//plugin.getLogger().info("DEBUG: Adding a list ");
|
if (DEBUG)
|
||||||
|
plugin.getLogger().info("DEBUG: Adding a list ");
|
||||||
// Loop through the collection resultset
|
// Loop through the collection resultset
|
||||||
// Note that we have no idea what type this is
|
// Note that we have no idea what type this is
|
||||||
List<Type> collectionTypes = Util.getCollectionParameterTypes(method);
|
List<Type> collectionTypes = Util.getCollectionParameterTypes(method);
|
||||||
@ -675,7 +676,8 @@ public class MySQLDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
|
|||||||
}
|
}
|
||||||
} else if (propertyDescriptor.getPropertyType().equals(Map.class) ||
|
} else if (propertyDescriptor.getPropertyType().equals(Map.class) ||
|
||||||
propertyDescriptor.getPropertyType().equals(HashMap.class)) {
|
propertyDescriptor.getPropertyType().equals(HashMap.class)) {
|
||||||
//plugin.getLogger().info("DEBUG: Adding a map ");
|
if (DEBUG)
|
||||||
|
plugin.getLogger().info("DEBUG: Adding a map ");
|
||||||
// Loop through the collection resultset
|
// Loop through the collection resultset
|
||||||
// Note that we have no idea what type this is
|
// Note that we have no idea what type this is
|
||||||
List<Type> collectionTypes = Util.getCollectionParameterTypes(method);
|
List<Type> collectionTypes = Util.getCollectionParameterTypes(method);
|
||||||
@ -683,16 +685,20 @@ public class MySQLDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
|
|||||||
Type keyType = collectionTypes.get(0);
|
Type keyType = collectionTypes.get(0);
|
||||||
Type valueType = collectionTypes.get(1);
|
Type valueType = collectionTypes.get(1);
|
||||||
value = new HashMap<Object, Object>();
|
value = new HashMap<Object, Object>();
|
||||||
//plugin.getLogger().info("DEBUG: collection type argument = " + collectionTypes);
|
if (DEBUG)
|
||||||
|
plugin.getLogger().info("DEBUG: collection type argument = " + collectionTypes);
|
||||||
while (collectionResultSet.next()) {
|
while (collectionResultSet.next()) {
|
||||||
//plugin.getLogger().info("DEBUG: adding to the map");
|
if (DEBUG)
|
||||||
|
plugin.getLogger().info("DEBUG: adding to the map");
|
||||||
//plugin.getLogger().info("DEBUG: collectionResultSet size = " + collectionResultSet.getFetchSize());
|
//plugin.getLogger().info("DEBUG: collectionResultSet size = " + collectionResultSet.getFetchSize());
|
||||||
// Work through the columns
|
// Work through the columns
|
||||||
// Key
|
// Key
|
||||||
Object key = deserialize(collectionResultSet.getObject(1),Class.forName(keyType.getTypeName()));
|
Object key = deserialize(collectionResultSet.getObject(1),Class.forName(keyType.getTypeName()));
|
||||||
//plugin.getLogger().info("DEBUG: key = " + key);
|
if (DEBUG)
|
||||||
|
plugin.getLogger().info("DEBUG: key = " + key);
|
||||||
Object mapValue = deserialize(collectionResultSet.getObject(2),Class.forName(valueType.getTypeName()));
|
Object mapValue = deserialize(collectionResultSet.getObject(2),Class.forName(valueType.getTypeName()));
|
||||||
//plugin.getLogger().info("DEBUG: value = " + mapValue);
|
if (DEBUG)
|
||||||
|
plugin.getLogger().info("DEBUG: value = " + mapValue);
|
||||||
((Map<Object,Object>) value).put(key,mapValue);
|
((Map<Object,Object>) value).put(key,mapValue);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -701,11 +707,18 @@ public class MySQLDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
|
|||||||
value = true;
|
value = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//plugin.getLogger().info("DEBUG: regular type");
|
if (DEBUG)
|
||||||
|
plugin.getLogger().info("DEBUG: regular type");
|
||||||
value = deserialize(value, propertyDescriptor.getPropertyType());
|
value = deserialize(value, propertyDescriptor.getPropertyType());
|
||||||
}
|
}
|
||||||
//plugin.getLogger().info("DEBUG: invoking method " + method.getName());
|
if (DEBUG) {
|
||||||
//plugin.getLogger().info("DEBUG: value class = " + value.getClass().getName());
|
plugin.getLogger().info("DEBUG: invoking method " + method.getName());
|
||||||
|
if (value == null) {
|
||||||
|
plugin.getLogger().info("DEBUG: value = null");
|
||||||
|
} else {
|
||||||
|
plugin.getLogger().info("DEBUG: value class = " + value.getClass().getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
// Write the value to the class
|
// Write the value to the class
|
||||||
method.invoke(instance, value);
|
method.invoke(instance, value);
|
||||||
}
|
}
|
||||||
@ -724,7 +737,8 @@ public class MySQLDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
private Object deserialize(Object value, Class<? extends Object> clazz) {
|
private Object deserialize(Object value, Class<? extends Object> clazz) {
|
||||||
//plugin.getLogger().info("DEBUG: deserialize - class is " + clazz.getTypeName());
|
if (DEBUG)
|
||||||
|
plugin.getLogger().info("DEBUG: deserialize - class is " + clazz.getTypeName());
|
||||||
if (value instanceof String && value.equals("null")) {
|
if (value instanceof String && value.equals("null")) {
|
||||||
// If the value is null as a string, return null
|
// If the value is null as a string, return null
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user