PathModify

com.softwaremill.quicklens.package$.PathModify
case class PathModify[S, A](obj: S, f: (A => A) => S)

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def apply(mod: A => A): S

An alias for using. Explicit calls to using are preferred over this alias, but quicklens provides this option because code auto-formatters (like scalafmt) will generally not keep modify/using pairs on the same line, leading to code like

An alias for using. Explicit calls to using are preferred over this alias, but quicklens provides this option because code auto-formatters (like scalafmt) will generally not keep modify/using pairs on the same line, leading to code like

x
 .modify(_.foo)
 .using(newFoo :: _)
 .modify(_.bar)
 .using(_ + newBar)

When using apply, scalafmt will allow

x
 .modify(_.foo)(newFoo :: _)
 .modify(_.bar)(_ + newBar)

Attributes

def setTo(v: A): S

Set the value of the field(s) to a new value.

Set the value of the field(s) to a new value.

Attributes

Returns

A copy of the root object with the (deeply nested) field(s) set to the new value.

def setToIf(condition: Boolean)(v: A): S

Set the value of the field(s) to a new value, if the condition is true. Otherwise, returns the original object unchanged.

Set the value of the field(s) to a new value, if the condition is true. Otherwise, returns the original object unchanged.

Attributes

Returns

A copy of the root object with the (deeply nested) field(s) set to the new value, if condition is true.

def setToIfDefined(v: Option[A]): S

Set the value of the field(s) to a new value, if it is defined. Otherwise, returns the original object unchanged.

Set the value of the field(s) to a new value, if it is defined. Otherwise, returns the original object unchanged.

Attributes

Returns

A copy of the root object with the (deeply nested) field(s) set to the new value, if it is defined.

def using(mod: A => A): S

Transform the value of the field(s) using the given function.

Transform the value of the field(s) using the given function.

Attributes

Returns

A copy of the root object with the (deeply nested) field(s) modified.

def usingIf(condition: Boolean)(mod: A => A): S

Transform the value of the field(s) using the given function, if the condition is true. Otherwise, returns the original object unchanged.

Transform the value of the field(s) using the given function, if the condition is true. Otherwise, returns the original object unchanged.

Attributes

Returns

A copy of the root object with the (deeply nested) field(s) modified, if condition is true.

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product