![JAR search and dependency download from the Maven repository](/logo.png)
eu.timepit.refined.api.Refined.scala Maven / Gradle / Ivy
package eu.timepit.refined.api
/**
* Wraps a value of type `T` that satisfies the predicate `P`. Instances of
* this class can be created with `[[refineV]]` and `[[refineMV]]` which
* verify that the wrapped value satisfies `P`.
*/
final class Refined[T, P] private (val value: T) extends AnyVal with Serializable {
override def toString: String =
value.toString
}
object Refined {
/**
* Wraps `t` in `[[Refined]][T, P]` ''without'' verifying that it satisfies
* the predicate `P`. This method is for internal use only.
*/
def unsafeApply[T, P](t: T): Refined[T, P] =
new Refined(t)
def unapply[T, P](r: Refined[T, P]): Some[T] =
Some(r.value)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy