RuntimeApi
RuntimeApi is the main trait to implement in order to provide redaction functionalities for a specific Scala version, such as the type aliases and method utilities to parse Scala's AST for the specific major version of Scala.
Type members
Types
The AST type of the method definition that will be patched.
The AST type of the method definition that will be patched.
The AST type for a Literal, such as a character like "(" .
The AST type for a Literal, such as a character like "(" .
The AST type for a position within a source file, useful for logging.
The AST type for a position within a source file, useful for logging.
The AST type for a TermName, such as methods like "toString" or ".$plus(..)" .
The AST type for a TermName, such as methods like "toString" or ".$plus(..)" .
The AST type of the Tree that will be validated.
The AST type of the Tree that will be validated.
Value members
Abstract methods
Given a tree
, it returns a List[Symbol] containing all the constructor's fields of the owner
Given a tree
, it returns a List[Symbol] containing all the constructor's fields of the owner
- Value parameters:
- owner
the Symbol of the related
case class
- Returns:
the List[Symbol] of all the fields in the
owner
s' constructor
Given a Tree passed as parameter, this method tries to convert it (via pattern-match) into a DefDef if it
actually represents a toString
method.
Given a tree
, it returns the name of its owner (regardless whether it is a case class
or something else)
Given a tree
, it returns the name of its owner (regardless whether it is a case class
or something else)
- Value parameters:
- tree
the Tree for which we would like to know its name
- Returns:
the String representation of the owner's name
Given the DefDef that represents the original toString
implementation, and the Tree that represents its
new body implementation, patch the new body into the existing definition, and return it.
Returns a list with all the Symbol(s) annotated with @redacted
from the given owner
Returns a list with all the Symbol(s) annotated with @redacted
from the given owner
- Value parameters:
- owner
the Symbol representing a
case class
reference for which we want all its@redacted
fields
- Returns:
a non-empty List[Symbol] with all the fields that are annotated with
@redacted
Given a Symbol that represents the owner
case class, and a Symbol that represents the constructor
field
inside it, it combines the two symbols in one Tree that is equivalent to selecting the field in the
case class.
Given a Symbol that represents the owner
case class, and a Symbol that represents the constructor
field
inside it, it combines the two symbols in one Tree that is equivalent to selecting the field in the
case class.
// class example
final case class User(id: Int, name: String, count: Int)
// can build some AST equivalent of
`User.this.id` or
`User.this.name` or
`User.this.count`
- Value parameters:
- field
the Symbol that reference one specific field in the
owner
's constructor- owner
the Symbol that references the owning
case class
- Returns:
the Tree that select the
field
within theowner
Concrete methods
Entry point of the redaction process: the tree
passed as parameter will be analysed and, if valid, it will be
patched and returned to the caller; otherwise, it will be returned unchanged.
Entry point of the redaction process: the tree
passed as parameter will be analysed and, if valid, it will be
patched and returned to the caller; otherwise, it will be returned unchanged.
- Value parameters:
- tree
the tree that might get patched
- Returns:
the patched (or not) tree