REVIEW COMMENTS

This commit is contained in:
Katelyn Baker 2018-01-04 16:16:48 +00:00
parent f4ad8d3e70
commit f230e2670b
2 changed files with 7 additions and 7 deletions

View File

@ -76,7 +76,7 @@ open class ObjectSerializer(val clazz: Type, factory: SerializerFactory) : AMQPS
obj: List<*>,
schemas: SerializationSchemas,
input: DeserializationInput) : Any = ifThrowsAppend({ clazz.typeName }){
logger.debug { "Calling construction based construction" }
logger.trace ("Calling construction based construction for ${clazz.typeName}")
return construct(obj.zip(propertySerializers.getters).map { it.second.readProperty(it.first, schemas, input) })
}
@ -85,7 +85,7 @@ open class ObjectSerializer(val clazz: Type, factory: SerializerFactory) : AMQPS
obj: List<*>,
schemas: SerializationSchemas,
input: DeserializationInput) : Any = ifThrowsAppend({ clazz.typeName }){
logger.debug { "Calling setter based construction" }
logger.trace ("Calling setter based construction for ${clazz.typeName}")
val instance : Any = javaConstructor?.newInstance() ?: throw NotSerializableException (
"Failed to instantiate instance of object $clazz")

View File

@ -92,7 +92,7 @@ private fun <T : Any> propertiesForSerializationFromConstructor(
.mapValues { it.value[0] }
if (properties.isNotEmpty() && kotlinConstructor.parameters.isEmpty()) {
return propertiesForSerializationFromGetters(properties, type, factory)
return propertiesForSerializationFromSetters(properties, type, factory)
}
val rc: MutableList<PropertySerializer> = ArrayList(kotlinConstructor.parameters.size)
@ -129,7 +129,7 @@ private fun <T : Any> propertiesForSerializationFromConstructor(
* If we determine a class has a constructor that takes no parameters then check for pairs of getters / setters
* and use those
*/
private fun propertiesForSerializationFromGetters(
private fun propertiesForSerializationFromSetters(
properties : Map<String, PropertyDescriptor>,
type: Type,
factory: SerializerFactory): ConstructorDestructorMethods {
@ -142,9 +142,9 @@ private fun propertiesForSerializationFromGetters(
if (getter == null || setter == null) return@forEach
// NOTE: For now we're ignoring type mismatches. I.e. where the setter or getter type differs
// from the underlying property as in this case the BEAN inspector doesn't return them as a property
// and thus they arne't visible here
// NOTE: There is no need to check return and parameter types vs the underlying type for
// the getter / setter vs property as if there is a difference then that property isn't reported
// by the BEAN inspector and thus we don't consider that case here
getters += PropertySerializer.make(property.key, getter, resolveTypeVariables(getter.genericReturnType, type),
factory)