mirror of
https://github.com/corda/corda.git
synced 2024-12-18 20:47:57 +00:00
Extract method to fix detekt ComplexMethod failure
This commit is contained in:
parent
e79f4ab8e2
commit
6a776a267b
@ -124,12 +124,7 @@ interface ObjectBuilder {
|
|||||||
}.toMutableMap()
|
}.toMutableMap()
|
||||||
|
|
||||||
if (includeAllConstructorParameters) {
|
if (includeAllConstructorParameters) {
|
||||||
// Add constructor parameters not in the list of properties
|
addMissingConstructorParameters(constructorIndices, constructor)
|
||||||
// so we can use them in object evolution
|
|
||||||
for ((parameterIndex, parameter) in constructor.parameters.withIndex()) {
|
|
||||||
// Only use the parameters not already matched to properties
|
|
||||||
constructorIndices.putIfAbsent(parameter.name, parameterIndex)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val propertySlots = constructorIndices.keys.mapIndexed { slot, name -> name to slot }.toMap()
|
val propertySlots = constructorIndices.keys.mapIndexed { slot, name -> name to slot }.toMap()
|
||||||
@ -139,6 +134,15 @@ interface ObjectBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun addMissingConstructorParameters(constructorIndices: MutableMap<String, Int>, constructor: LocalConstructorInformation) {
|
||||||
|
// Add constructor parameters not in the list of properties
|
||||||
|
// so we can use them in object evolution
|
||||||
|
for ((parameterIndex, parameter) in constructor.parameters.withIndex()) {
|
||||||
|
// Only use the parameters not already matched to properties
|
||||||
|
constructorIndices.putIfAbsent(parameter.name, parameterIndex)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun makeSetterBasedProvider(
|
private fun makeSetterBasedProvider(
|
||||||
properties: Map<String, LocalPropertyInformation>,
|
properties: Map<String, LocalPropertyInformation>,
|
||||||
typeIdentifier: TypeIdentifier,
|
typeIdentifier: TypeIdentifier,
|
||||||
|
Loading…
Reference in New Issue
Block a user