sealed trait ParseResult[+A] extends AnyRef
Trait containing the result of an XmlReader. It can contain one of the following:
- ParseSuccess indicates a completely successful result
- ParseFailure indicates a completely failed result
- PartialParseSuccess indicates there were recoverable errors and contains both the result and a list of errors that occurred.
- Self Type
- ParseResult[A]
- Alphabetic
- By Inheritance
- ParseResult
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def errors: Seq[ParseError]
A sequence of all ParseErrors that occurred.
- abstract def get: A
- Attributes
- protected
- abstract def isSuccessful: Boolean
Is the result a success, i.e.
Is the result a success, i.e. either a ParseSuccess or a PartialParseSuccess.
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def collect[B](pf: PartialFunction[A, B]): ParseResult[B]
Apply a PartialFunction to the result value.
Apply a PartialFunction to the result value. If the
pffunction isn't defined for the result value a ParseFailure is returned. - final def collect[B](otherwise: => ParseError)(pf: PartialFunction[A, B]): ParseResult[B]
Apply a PartialFunction to the result value.
Apply a PartialFunction to the result value. If the
pfisn't defined for the result value, a ParseFailure with theotherwiseerror is returned. - final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def filter(f: (A) => Boolean): ParseResult[A]
- f
Predicate to filter the ParseResult by
- returns
this if the test passes, or ParseFailure if the test fails.
- def filter(error: => ParseError)(f: (A) => Boolean): ParseResult[A]
- error
The error to use if the test fails.
- f
Predicate to filter the ParseResult by
- returns
if the result is successful and the filter fails ParseFailure is returned
- def flatMap[B](f: (A) => ParseResult[B]): ParseResult[B]
FlatMap over the result value.
FlatMap over the result value.
One thing to note is that if this is a PartialParseSuccess, then the errors are prepended to the result of calling
fon the value. So for example, iffreturns a ParseSuccess, but this is a PartialParseSuccess the final result will be a PartialParseSuccess containing the result fromfand the errors from this. - def fold[B](onFailure: (Seq[ParseError]) => B)(onSuccess: (A) => B): B
Handle both success and failure.
Handle both success and failure.
- onFailure
Function to handle a ParseFailure.
- onSuccess
Function to process a successful parse.
- def foreach(f: (A) => Unit): Unit
Execute
fon the result value if and only if this ParseResult is successful.Execute
fon the result value if and only if this ParseResult is successful.- f
the function to execute.
- Annotations
- @inline()
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def getOrElse[B >: A](otherwise: => B): B
- returns
the result value, unless this is a ParseFailure in which case return
otherwise.
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def map[B](f: (A) => B): ParseResult[B]
Map a function over the result value.
Map a function over the result value. The level of success, and any errors are propagated.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def or[B >: A](other: ParseResult[B]): ParseResult[B]
- returns
this if this is successful, otherwise return other if other is successful, and a
ParseFailurecontaining errors from both if both failed.
- def orElse[B >: A](otherwise: => ParseResult[B]): ParseResult[B]
Like
or, but takeotherwiseas a by-name parameter, and don't combine errors from both.Like
or, but takeotherwiseas a by-name parameter, and don't combine errors from both.- returns
this if this is successful otherwise return
otherwise.
- def recoverPartial[B >: A](otherwise: => B): ParseResult[B]
If this is a ParseFailure recover as a PartialParseSuccess containing
otherwiseso that the errors are kept. - final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toOption: Option[A]
Convert to an Option
Convert to an Option
- returns
a Some containing the result if successful, or a None if a failure
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def withFilter(f: (A) => Boolean): ParseResult[A]
Alias for filter
- def |[B >: A](other: ParseResult[B]): ParseResult[B]
Alias for
or