Skip to content
Snippets Groups Projects

Throw execption, if load or resource type not found

1 file
+ 2
3
Compare changes
  • Side-by-side
  • Inline
@@ -21,8 +21,7 @@ class PatcherDefinitionFactory {
* value of the requiredType.
*/
fun createPatcherDefinition(requiredType: String, patcherTypes: List<TypeName>): List<PatcherDefinition> {
return patcherTypes
.filter { type -> type.typeName == requiredType }
.flatMap { type -> type.patchers }
return patcherTypes.firstOrNull() { type -> type.typeName == requiredType }
?.patchers ?: throw IllegalArgumentException("typeName $requiredType not found.")
}
}
Loading