def of()

in finagle-mysql/src/main/scala/com/twitter/finagle/mysql/Parameter.scala [144:168]


  def of(value: Any): Parameter = value match {
    case null => NullParameter
    case Some(v) => of(v)
    case None => NullParameter
    case v: String => wrap(v)
    case v: Boolean => wrap(v)
    case v: Byte => wrap(v)
    case v: Short => wrap(v)
    case v: Int => wrap(v)
    case v: Long => wrap(v)
    case v: Float => wrap(v)
    case v: Double => wrap(v)
    case v: Array[Byte] => wrap(v)
    case v: Value => wrap(v)
    case v: java.sql.Timestamp => wrap(v)
    case v: java.sql.Date => wrap(v)
    case v: java.util.Date => wrap(v)
    case o: java.util.Optional[_] if o.isPresent => of(o.get())
    case o: java.util.Optional[_] => NullParameter
    case v =>
      // Unsupported type. Write the error to log, and write the type as null.
      // This allows us to safely skip writing the parameter without corrupting the buffer.
      log.warning(s"Unknown parameter ${v.getClass.getName} will be treated as SQL NULL.")
      NullParameter
  }