提交 bc33802c 编写于 作者: 梦境迷离's avatar 梦境迷离

fix style

上级 c752515d
......@@ -47,7 +47,17 @@ class Transformable[From, To] {
): Transformable[From, To] =
macro TransformerMacro.mapTypeImpl[From, To, FromField, ToField]
/** Same method as above, but without the map parameter. That is, no type mapping needs to be configured.
/** @param selectFromField
* Select the name of the field to be mapped in the `From` class.
* @param selectToField
* Select the name of the field to be mapped in the `To` class.
*
* @tparam FromField
* field type
* @tparam ToField
* field type
* @return
* Transformable
*/
@unchecked
def setName[FromField, ToField](
......
......@@ -35,7 +35,7 @@ class TransformableTest extends AnyFlatSpec with Matchers {
case class A2(a: String, b: Int, c: Int, d: Option[String])
val a = A1("hello", 1, 2, None)
val b: A2 = Transformable[A1, A2]
val b: A2 = Transformable[A1, A2]
.setName(_.cc, _.c)
.setType[Long, Int](_.cc, fromField => if (fromField > 0) fromField.toInt else 0)
.instance
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册