JsResult

play.api.libs.json.JsResult
See theJsResult companion object
sealed trait JsResult[+A]

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class JsError
class JsSuccess[T]
Self type

Members list

Type members

Classlikes

final class WithFilter(p: A => Boolean)

Attributes

Supertypes
class Object
trait Matchable
class Any

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).

Attributes

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.

Attributes

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'''

Attributes

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'''

Attributes

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.

Attributes

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.

Attributes

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

Attributes

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.

Attributes

def get: A

Not recommended

Not recommended

Attributes

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.

Attributes

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.

Attributes

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.

Attributes

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.

Attributes

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.

Attributes

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.

Attributes

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

Updates the JSON path

Updates the JSON path

Attributes

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