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

add @constructor

上级 189ac9ee
......@@ -180,7 +180,6 @@ The `@log` does not use mixed or wrapper, but directly uses macro to generate de
- `io.github.dreamylost.LogType.Slf4j` use `org.slf4j.Logger`
- Support `class`, `case class` and `object`.
> IDE support is not very good, a red prompt will appear, but the compilation is OK. You need to provide their dependencies and configuration, please refer to the test.
- Example
......@@ -212,6 +211,34 @@ The `@apply` used to generate `apply` method for primary construction of ordinar
println(B2(1, 2))
```
## @constructor
The `@constructor` used to generate secondary constructor method for classes.
- Note
- `verbose` Whether to enable detailed log.
- `excludeFields` Whether to exclude the specified `var` fields, default is `Nil`.
- Only support `class`.
- Currying is not supported for constructors at present.
- When used with `@toString`, it must be put last. Known problems.
> IDE support is not very good, a red prompt will appear, but the compilation is OK. You need to provide their dependencies and configuration, please refer to the test.
- Example
```scala
@constructor(excludeFields = Seq("c"))
class A2(int: Int, val j: Int, var k: Option[String] = None, t: Option[Long] = Some(1L)) {
private val a: Int = 1
var b: Int = 1 //The default value of the field is not carried to the apply parameter, so all parameters are required.
protected var c: Int = _
def helloWorld: String = "hello world"
}
println(new A2(1, 2, None, None, 100))
```
# How to use
Add library dependency
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册