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.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
trait Scala3Runtime
- Self type
Members list
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.
Attributes
The AST type for a Literal, such as a character like "(" .
The AST type for a Literal, such as a character like "(" .
Attributes
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.
Attributes
The AST type for a Symbol.
The AST type for a Symbol.
Attributes
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(..)" .
Attributes
The AST type of the Tree that will be validated.
The AST type of the Tree that will be validated.
Attributes
Value members
Abstract methods
Given a Tree passed as parameter, tries to retrieve its case class
owner.
Given a Tree passed as parameter, tries to retrieve its case class
owner.
Value parameters
- tree
-
for which we would like to retrieve its case class owner
Attributes
- Returns
-
an Option containing either the Symbol of its owner, or None
Given two Trees, combine them together using the String.+(..) operator, to concatenate them together
Given two Trees, combine them together using the String.+(..) operator, to concatenate them together
Value parameters
- lhs
-
the left-hand-sde Tree
- rhs
-
the right-hand-sde Tree
- stringConcatOperator
-
the String operator for concatenating two items
Attributes
- Returns
-
the Tree that represents the concatenation of the two items
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
Attributes
- 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
Attributes
- 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.
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.
Value parameters
- newToStringBody
-
the Tree that provides redaction for the sensitive fields
- toStringDef
-
the DefDef which represents the original
toString
AST
Attributes
- Returns
-
the DefDef that will contain the patched body
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
Attributes
- 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
Attributes
- Returns
-
the Tree that select the
field
within theowner
Attributes
- Returns
-
the TermName that is used to concatenate two Strings, i.e. "+" or ".$plus"
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
Attributes
- Returns
-
the patched (or not) tree
Abstract fields
Concrete fields
the FQDN of @redacted
annotation
the FQDN of @redacted
annotation
Attributes
the name of toString
method
the name of toString
method