JsResult

sealed trait JsResult[+A]
Companion
object
class Object
trait Matchable
class Any
class JsError
class JsSuccess[T]

Type members

Classlikes

final class WithFilter(p: A => Boolean)

Value members

Abstract methods

def asEither: Either[Seq[(JsPath, Seq[JsonValidationError])], A]

Returns either the result errors (at Left), or the successful value (at Right).

Returns either the result errors (at Left), or the successful value (at Right).

def asOpt: Option[A]

Transforms this result either Some option with the successful value, or as None in case of JSON error.

Transforms this result either Some option with the successful value, or as None in case of JSON error.

def contains[AA >: A](elem: AA): Boolean

If this result is successful than checks for presence for '''elem''', otherwise return '''false'''

If this result is successful than checks for presence for '''elem''', otherwise return '''false'''

def exists(p: A => Boolean): Boolean

If this result is successful than check value with predicate '''p''', otherwise return '''false'''

If this result is successful than check value with predicate '''p''', otherwise return '''false'''

def flatMap[B](f: A => JsResult[B]): JsResult[B]

If this result is successful, applies the function f on the parsed value.

If this result is successful, applies the function f on the parsed value.

def fold[B](invalid: Seq[(JsPath, Seq[JsonValidationError])] => B, valid: A => B): B

Either applies the invalid function if this result is an error, or applies the valid function on the successful value.

Either applies the invalid function if this result is an error, or applies the valid function on the successful value.

def forall(p: A => Boolean): Boolean

If this result is successful than check value with predicate '''p''', otherwise return '''true'''. Follows scala.collection.Traversable.forall semantics

If this result is successful than check value with predicate '''p''', otherwise return '''true'''. Follows scala.collection.Traversable.forall semantics

def foreach(f: A => Unit): Unit

If this result is successful, applies the function f on the parsed value.

If this result is successful, applies the function f on the parsed value.

def get: A

Not recommended

Not recommended

def getOrElse[AA >: A](t: => AA): AA

Either returns the successful value, or the value from t.

Either returns the successful value, or the value from t.

def isError: Boolean
def isSuccess: Boolean
def map[B](f: A => B): JsResult[B]

If this result is successful, applies the function f on the parsed value.

If this result is successful, applies the function f on the parsed value.

def orElse[AA >: A](t: => JsResult[AA]): JsResult[AA]

Either returns this result if successful, or the result from t.

Either returns this result if successful, or the result from t.

def recover[AA >: A](errManager: PartialFunction[JsError, AA]): JsResult[AA]

If this result is not successful, recovers the errors with the given function.

If this result is not successful, recovers the errors with the given function.

def recoverTotal[AA >: A](errManager: JsError => AA): AA

If this result is not successful, recovers the errors with the given function.

If this result is not successful, recovers the errors with the given function.

def recoverWith[AA >: A](errManager: JsError => JsResult[AA]): JsResult[AA]

If this result is not successful, recovers the errors with the given function.

If this result is not successful, recovers the errors with the given function.

def repath(path: JsPath): JsResult[A]

Updates the JSON path

Updates the JSON path

Concrete methods

def collect[B](otherwise: JsonValidationError)(p: PartialFunction[A, B]): JsResult[B]
def filter(p: A => Boolean): JsResult[A]
def filter(otherwise: JsError)(p: A => Boolean): JsResult[A]
def filterNot(error: JsError)(p: A => Boolean): JsResult[A]
def filterNot(p: A => Boolean): JsResult[A]
def withFilter(p: A => Boolean): WithFilter