-
Notifications
You must be signed in to change notification settings - Fork 3
Do you have a plan to support abstract class? #5
Comments
@kenchan0130 Do you mean something like: @customize
abstract class RootClass
case class Child(@mask field: String) ? |
For example, @customize
sealed abstract class RootClass(@mask val value: String)
case object Child1 extends RootClass("child1")
case object Child2 extends RootClass("child2") like this. |
I see, thanks. An interesting case, I'll try to look into implementing it. What kind of data do you store in the "value" field? I'm asking because I'm curious what needs to be masked from |
I'm so sorry. trait SomeLibraryTrait[T] {
val value: T
override def toString() = value.toString()
}
@customize
abstract class EmployeePrivateInfo(@mask val value: Int) extends SomeLibraryTrait[Int]
case object Bachelor extends EmployeePrivateInfo(1)
case object AlreadyMarried extends EmployeePrivateInfo(2) Specifically, it is here. Certainly, I can also create custom trait with masking string like: trait MaskTrait[T] extends SomeLibraryTrait[T] {
override val value: T
override def toString() = "*****"
}
// Without using stringmask library
abstract class EmployeePrivateInfo(val value: Int) extends MaskTrait[Int]
case object Bachelor extends EmployeePrivateInfo(1)
case object AlreadyMarried extends EmployeePrivateInfo(2) |
I see, but still the masked values |
I have the case I want to mask in a complex situation. In the case where it is important personal information when two items are combined, case class Employee(name: EmployeeName, privateInfo: EmployeePrivateInfo) Of course, because of the different responsibilities, there may be some opinion that it should be marked on the upper layer like: @customize
case class Employee(name: EmployeeName, @mask privateInfo: EmployeePrivateInfo) However, in this case, some developers may forget to mask value because |
Thanks for explaining. I can see how supporting abstract classes fits to this case. I will look into supporting abstract classes. |
I'd like to use masking feature even in abstract class (or sealed abstract class) and I know if this library only supports case class.
Do you have a plan to support it in this library?
The text was updated successfully, but these errors were encountered: