def selectDynamic()

in kernel-api/src/main/scala/org/apache/toree/utils/DynamicReflectionSupport.scala [43:60]


  def selectDynamic(name: String): Any = {
    val method = getMethod(name, Nil)
    method match {
      case Some(m) => invokeMethod(m, Nil)
      case _ =>
        try {
          val field = klass.getDeclaredField(name)
          field.setAccessible(true)
          field.get(instance)
        } catch {
          case ex: NoSuchFieldException =>
            throw new NoSuchFieldException(
              klass.getName + "." + name + " does not exist!"
            )
          case ex: Throwable => throw ex
        }
    }
  }