ValueClasses
io.scalaland.chimney.internal.compiletime.datatypes.ValueClasses
trait ValueClasses
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
trait ValueClassesPlatform
- Self type
Members list
Type members
Classlikes
final protected case class ValueClass[Outer, Inner](fieldName: String, unwrap: Expr[Outer] => Expr[Inner], wrap: Expr[Inner] => Expr[Outer])
Let us unwrap and wrap value in AnyVal value class
Let us unwrap and wrap value in AnyVal value class
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ValueClassType.type
final protected case class WrapperClass[Outer, Inner](fieldName: String, unwrap: Expr[Outer] => Expr[Inner], wrap: Expr[Inner] => Expr[Outer])
Let us unwrap and wrap value in any class that wraps a single value (not only AnyVals)
Let us unwrap and wrap value in any class that wraps a single value (not only AnyVals)
For a class to be considered wrapper it has to:
- have a public unary constructor
- expose a getter of the same name and type as constructor's argument
Basically, it is a value class without the need to extends AnyVal. This is useful since sometimes we have a type which is basically a wrapper but not an AnyVal and we would like to unwrap it and attempt to derive code as if it was AnyVal. Since it is very contextual, we need to have a separate utility for that.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object WrapperClassType.type
- Self type
Value members
Abstract fields
In this article