Skip to content

Latest commit

 

History

History
33 lines (25 loc) · 1.21 KB

README.md

File metadata and controls

33 lines (25 loc) · 1.21 KB

stringmask

Maven Central ![Software License](https://img.shields.io/badge/license-Apache 2-brightgreen.svg?style=flat) Build Status

A micro-library for macro-based case class field masking in .toString(). Inspired by blog by Juan Pedro Moreno @47deg: http://www.47deg.com/blog/scala-macros-annotate-your-case-classes

#Using stringmask Builds are available for Scala 2.10.x and 2.11.x

libraryDependencies ++= Seq(
  "com.softwaremill.stringmask" %% "stringmask" % "1.0.0",
  compilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)
)

Example usage:

import com.softwaremill.macros.customize.{customize, mask}
import java.util.Date

@customize
case class User(id: Long, @mask email: String, @mask dob: Date)
val user = User(1, "johndoe@email.com", new Date(1458732695220L))

user.toString

should return User(1,***,***)