All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.twitter.finatra.json.internal.caseclass.reflection.DefaultMethodUtils.scala Maven / Gradle / Ivy

package com.twitter.finatra.json.internal.caseclass.reflection

object DefaultMethodUtils {

  def defaultFunction(companionObjectClass: Class[_], companionObject: Any, constructorParamIdx: Int): Option[() => Object] = {
    val defaultMethodArgNum = constructorParamIdx + 1
    companionObjectClass.getMethods.find { method =>
      method.getName == "$lessinit$greater$default$" + defaultMethodArgNum
    } map { method =>
      () => method.invoke(companionObject)
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy