object Result
Companion to io.scalaland.chimney.partial.Result.
- Since
0.7.0
- See also
https://chimney.readthedocs.io/supported-transformations/#total-transformers-vs-partialtransformers
- Alphabetic
- By Inheritance
- Result
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
final
case class
Errors(errors: NonEmptyErrorsChain) extends Result[Nothing] with Product with Serializable
Errors case representation.
Errors case representation.
- errors
non-empty collection of path-annotated errors
- Since
0.7.0
-
final
case class
Value[A](value: A) extends Result[A] with Product with Serializable
Success value case representation.
Success value case representation.
- A
type of success value
- value
value of type
A
- Since
0.7.0
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( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
fromCatching[A](value: ⇒ A): Result[A]
Converts possibly throwing computation into io.scalaland.chimney.partial.Result.
Converts possibly throwing computation into io.scalaland.chimney.partial.Result.
- A
type of successful result
- value
computation to run while catching its Exceptions
- returns
successful io.scalaland.chimney.partial.Result.Value if computation didn't throw, failed io.scalaland.chimney.partial.Result.Errors with caught Exception if it threw
- Since
0.7.0
-
final
def
fromEither[A](value: Either[Errors, A]): Result[A]
Converts Either to io.scalaland.chimney.partial.Result, using Errors from Left as failed result.
Converts Either to io.scalaland.chimney.partial.Result, using Errors from Left as failed result.
- A
type of successful result
- value
Either to convert
- returns
successful result if scala.Right, failed result if scala.Left
- Since
0.7.0
-
final
def
fromEitherString[A](value: Either[String, A]): Result[A]
Converts Either to io.scalaland.chimney.partial.Result, using an error message from Left as failed result.
Converts Either to io.scalaland.chimney.partial.Result, using an error message from Left as failed result.
- A
type of successful result
- value
Either to convert
- returns
successful result if scala.Right, failed result with an error message if scala.Left
- Since
0.7.0
-
final
def
fromEmpty[A]: Result[A]
Creates failed Result with an empty value error.
Creates failed Result with an empty value error.
- A
type of successful result
- returns
failed io.scalaland.chimney.partial.Result.Errors containing one io.scalaland.chimney.partial.Error.fromEmptyValue
- Since
0.7.0
-
final
def
fromError[A](error: Error): Result[A]
Creates failed io.scalaland.chimney.partial.Result from a single error.
Creates failed io.scalaland.chimney.partial.Result from a single error.
- A
type of successful result
- error
required error
- returns
failed io.scalaland.chimney.partial.Result.Errors containing one io.scalaland.chimney.partial.Error
- Since
0.7.0
-
final
def
fromErrorNotDefinedAt[A](value: Any): Result[A]
Creates failed io.scalaland.chimney.partial.Result from argument for which PartialFunction was not defined.
Creates failed io.scalaland.chimney.partial.Result from argument for which PartialFunction was not defined.
- A
type of successful result
- value
value for which partial function was not defined
- returns
result containing one error
- Since
0.7.0
-
final
def
fromErrorString[A](message: String): Result[A]
Creates failed io.scalaland.chimney.partial.Result from an error message.
Creates failed io.scalaland.chimney.partial.Result from an error message.
- A
type of successful result
- message
message to wrap in Error
- returns
result containing one error
- Since
0.7.0
-
final
def
fromErrorStrings[A](message: String, messages: String*): Result[A]
Creates failed io.scalaland.chimney.partial.Result from one error message or more.
Creates failed io.scalaland.chimney.partial.Result from one error message or more.
- A
type of successful result
- message
required message to wrap in Error
- messages
optional messages to wrap in Error
- returns
result aggregating all passed errors
- Since
0.7.0
-
final
def
fromErrorThrowable[W](throwable: Throwable): Result[W]
Creates failed io.scalaland.chimney.partial.Result from Exception that was caught.
Creates failed io.scalaland.chimney.partial.Result from Exception that was caught.
- W
type of successful result
- throwable
exception
- returns
result containing one error
- Since
0.7.0
-
final
def
fromErrors[A](error: Error, errors: Error*): Result[A]
Creates failed io.scalaland.chimney.partial.Result from one error or more.
Creates failed io.scalaland.chimney.partial.Result from one error or more.
- A
type of successful result
- error
required head io.scalaland.chimney.partial.Error
- errors
optional tail io.scalaland.chimney.partial.Errors
- returns
failed io.scalaland.chimney.partial.Result.Errors aggregating all passed io.scalaland.chimney.partial.Errors
- Since
0.7.0
-
final
def
fromFunction[A, B](f: (A) ⇒ B): (A) ⇒ Result[B]
Converts a function that throws Exceptions into function that returns io.scalaland.chimney.partial.Result.
Converts a function that throws Exceptions into function that returns io.scalaland.chimney.partial.Result.
- A
input type
- B
output type
- f
function that possibly throws
- returns
function that catches Exceptions as io.scalaland.chimney.partial.Result.Errors
- Since
0.7.0
-
final
def
fromOption[A](value: Option[A]): Result[A]
Converts Option to io.scalaland.chimney.partial.Result, using EmptyValue error if None.
Converts Option to io.scalaland.chimney.partial.Result, using EmptyValue error if None.
- A
type of successful result
- value
Option to convert
- returns
successful result if scala.Some, failed result with EmptyValue error if None
- Since
0.7.0
-
final
def
fromOptionOrError[A](value: Option[A], ifEmpty: ⇒ Error): Result[A]
Converts Option to io.scalaland.chimney.partial.Result, using provided Error if None.
Converts Option to io.scalaland.chimney.partial.Result, using provided Error if None.
- A
type of successful result
- value
Option to convert
- ifEmpty
lazy error for scala.None
- returns
successful result if scala.Some, failed result with provided error if scala.None
- Since
0.7.0
-
final
def
fromOptionOrString[A](value: Option[A], ifEmpty: ⇒ String): Result[A]
Converts Option to io.scalaland.chimney.partial.Result, using provided error message if None.
Converts Option to io.scalaland.chimney.partial.Result, using provided error message if None.
- A
type of successful result
- value
scala.Option to convert
- ifEmpty
lazy error message for scala.None
- returns
successful result if scala.Some, failed result with provided error message if scala.None
- Since
0.7.0
-
final
def
fromOptionOrThrowable[A](value: Option[A], ifEmpty: ⇒ Throwable): Result[A]
Converts Option to Result, using provided Throwable if None.
Converts Option to Result, using provided Throwable if None.
- A
type of successful result
- value
Option to convert
- ifEmpty
lazy error for scala.None
- returns
successful result if scala.Some, failed result with provided Throwable if scala.None
- Since
0.7.0
-
final
def
fromPartialFunction[A, B](pf: PartialFunction[A, B]): (A) ⇒ Result[B]
Converts a partial function that throws Exceptions into function that returns io.scalaland.chimney.partial.Result.
Converts a partial function that throws Exceptions into function that returns io.scalaland.chimney.partial.Result.
- A
input type
- B
output type
- pf
partial function that possibly throws
- returns
function that catches Exceptions and arguments without defined value as io.scalaland.chimney.partial.Result.Errors
- Since
0.7.0
-
final
def
fromTry[A](value: Try[A]): Result[A]
Converts Try to io.scalaland.chimney.partial.Result, using Throwable from Failure as failed result.
Converts Try to io.scalaland.chimney.partial.Result, using Throwable from Failure as failed result.
- A
type of successful result
- value
scala.util.Try to convert
- returns
successful result if scala.util.Success, failed result with Throwable if scala.util.Failure
- Since
0.7.0
-
final
def
fromValue[A](value: A): Result[A]
Creates successful io.scalaland.chimney.partial.Result from a precomputed value.
Creates successful io.scalaland.chimney.partial.Result from a precomputed value.
- A
type of successful value
- value
successful value to return in result
- returns
successful io.scalaland.chimney.partial.Result.Value
- Since
0.7.0
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
map2[A, B, C](resultA: Result[A], resultB: ⇒ Result[B], f: (A, B) ⇒ C, failFast: Boolean): Result[C]
Combines 2 io.scalaland.chimney.partial.Results into 1 by combining their successful values or aggregating errors.
Combines 2 io.scalaland.chimney.partial.Results into 1 by combining their successful values or aggregating errors.
- A
first successful input type
- B
second successful input type
- C
successful output type
- resultA
first Result
- resultB
second Result
- f
function combining 2 successful input values into successful output value
- failFast
whether conversion should stop at first failed element or should it aggregate errors from both Results
- returns
successful io.scalaland.chimney.partial.Result.Value of combination if both io.scalaland.chimney.partial.Results were successful, failed io.scalaland.chimney.partial.Result.Errors if at least one of io.scalaland.chimney.partial.Results were failure
- Since
0.7.0
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
product[A, B](resultA: Result[A], resultB: ⇒ Result[B], failFast: Boolean): Result[(A, B)]
Combines 2 io.scalaland.chimney.partial.Results into 1 by tupling their successful values or aggregating errors.
Combines 2 io.scalaland.chimney.partial.Results into 1 by tupling their successful values or aggregating errors.
- A
first successful input type
- B
second successful input type
- resultA
- resultB
- failFast
whether conversion should stop at first failed element or should it aggregate errors from both io.scalaland.chimney.partial.Results
- returns
successful io.scalaland.chimney.partial.Result.Value with a tuple if both io.scalaland.chimney.partial.Results were successful, failed io.scalaland.chimney.partial.Result.Errors if at least one of io.scalaland.chimney.partial.Result were failure
- Since
0.7.0
-
final
def
sequence[M, A](it: Iterator[Result[A]], failFast: Boolean)(implicit fac: scala.collection.compat.Factory[A, M]): Result[M]
Converts an scala.collection.Iterator containing io.scalaland.chimney.partial.Results into a io.scalaland.chimney.partial.Result with selected collection of successful values.
Converts an scala.collection.Iterator containing io.scalaland.chimney.partial.Results into a io.scalaland.chimney.partial.Result with selected collection of successful values.
- M
type of output - output collection of output element
- A
type of successful values in Results
- it
iterator with Results to aggregate
- failFast
whether conversion should stop at first failed element conversion or should it continue to aggregate all errors
- fac
factory of output type
- returns
result with user-selected collection of converted elements if all conversions succeeded, result with conversion errors if at least one conversion failed
- Since
0.7.0
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
traverse[M, A, B](it: Iterator[A], f: (A) ⇒ Result[B], failFast: Boolean)(implicit fac: scala.collection.compat.Factory[B, M]): Result[M]
Converts an scala.collection.Iterator of input type into selected collection of output type, aggregating errors from conversions of individual elements.
Converts an scala.collection.Iterator of input type into selected collection of output type, aggregating errors from conversions of individual elements.
- M
type of output - output collection of output element
- A
type of elements of input
- B
type of elements of output
- it
iterator with elements to convert
- f
function converting each individual element to Result
- failFast
whether conversion should stop at first failed element conversion or should it continue to aggregate all errors
- fac
factory of output type
- returns
io.scalaland.chimney.partial.Result.Value with user-selected collection of converted elements if all conversions succeeded, io.scalaland.chimney.partial.Result.Errors with conversion errors if at least one conversion failed
- Since
0.7.0
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
- object Errors extends Serializable