final case class DurationOps(underlying: Duration) extends AnyVal with Product with Serializable
Enriches a Duration with scala friendly methods.
- Source
- TemporalAmountOps.scala
- Alphabetic
- By Inheritance
- DurationOps
- Serializable
- Product
- Equals
- AnyVal
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Instance Constructors
- new DurationOps(underlying: Duration)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- Any
- final def ##(): Int
- Definition Classes
- Any
- def *(scalar: Int): Duration
Obtains a copy of this duration multiplied by the scalar.
Obtains a copy of this duration multiplied by the scalar.
- Exceptions thrown
ArithmeticException
- if numeric overflow occurs
- def +(amount: Long, unit: TemporalUnit): Duration
Obtains a copy of this duration with a duration added measured in terms of the specified unit.
Obtains a copy of this duration with a duration added measured in terms of the specified unit.
- Exceptions thrown
ArithmeticException
- if numeric overflow occursUnsupportedTemporalTypeException
- if the unit is not supported
- def +(duration: Duration): Duration
Obtains a copy of this duration with the specified duration added.
Obtains a copy of this duration with the specified duration added.
- Exceptions thrown
ArithmeticException
- if numeric overflow occurs
- def -(amount: Long, unit: TemporalUnit): Duration
Obtains a copy of this duration with a duration subtracted measured in terms of the specified unit.
Obtains a copy of this duration with a duration subtracted measured in terms of the specified unit.
- Exceptions thrown
ArithmeticException
- if numeric overflow occursUnsupportedTemporalTypeException
- if the unit is not supported
- def -(duration: Duration): Duration
Obtains a copy of this duration with the specified duration subtracted.
Obtains a copy of this duration with the specified duration subtracted.
- Exceptions thrown
ArithmeticException
- if numeric overflow occurs
- def ->[B](y: B): (DurationOps, B)
- Implicit
- This member is added by an implicit conversion from DurationOps toArrowAssoc[DurationOps] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
- def /(divisor: Int): Duration
Obtains a copy of this duration divided by the divisor.
Obtains a copy of this duration divided by the divisor.
- Exceptions thrown
ArithmeticException
- if numeric overflow occurs
- final def ==(arg0: Any): Boolean
- Definition Classes
- Any
- def asConcurrentDuration: Duration
Obtains a scala.concurrent.duration.Duration from the value of this duration in nanoseconds.
Obtains a scala.concurrent.duration.Duration from the value of this duration in nanoseconds.
- Exceptions thrown
ArithmeticException
- if numeric overflow occurs
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def ensuring(cond: (DurationOps) => Boolean, msg: => Any): DurationOps
- Implicit
- This member is added by an implicit conversion from DurationOps toEnsuring[DurationOps] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: (DurationOps) => Boolean): DurationOps
- Implicit
- This member is added by an implicit conversion from DurationOps toEnsuring[DurationOps] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean, msg: => Any): DurationOps
- Implicit
- This member is added by an implicit conversion from DurationOps toEnsuring[DurationOps] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean): DurationOps
- Implicit
- This member is added by an implicit conversion from DurationOps toEnsuring[DurationOps] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from DurationOps toStringFormat[DurationOps] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @inline()
- def getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def unary_!: Duration
Swaps the sign of the total length of this duration.
Swaps the sign of the total length of this duration. For example, PT1.3S will be returned as PT-1.3S.
- Exceptions thrown
ArithmeticException
- if numeric overflow occurs
- val underlying: Duration
Shadowed Implicit Value Members
- def +(other: String): String
- Implicit
- This member is added by an implicit conversion from DurationOps toany2stringadd[DurationOps] performed by method any2stringadd in scala.Predef.
- Shadowing
- This implicitly inherited member is shadowed by one or more members in this class.
To access this member you can use a type ascription:(durationOps: any2stringadd[DurationOps]).+(other)
- Definition Classes
- any2stringadd
Deprecated Value Members
- def →[B](y: B): (DurationOps, B)
- Implicit
- This member is added by an implicit conversion from DurationOps toArrowAssoc[DurationOps] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use
->
instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.
Scala Time
scala-time is a simple Scala wrapper for easier use JDK 1.8.0 (Java 8) time APIs
Overview
The library is contained in the scalatime package which includes extension methods provided via implicit conversion methods to Scala value classes.
For usage examples see below: