in models/src/main/kotlin/motif/models/FactoryMethod.kt [75:88]
fun fromObjectsMethod(objects: Objects, method: IrMethod): FactoryMethod {
if (method.isVoid()) throw VoidFactoryMethod(objects, method)
if (method.isNullable() || method.returnType.toString().endsWith("?")) {
throw NullableFactoryMethod(objects, method)
}
ensureNonNullParameters(objects.scope, objects.clazz, method)
if (!method.isAbstract()) return BasicFactoryMethod.create(objects, method)
if (!method.hasParameters()) return ConstructorFactoryMethod.create(objects, method)
if (method.parameters.size == 1) return BindsFactoryMethod.create(objects, method)
throw InvalidFactoryMethod(objects, method)
}