org.feijoas.mango.common.base

Suppliers

Related Doc: package base

object Suppliers

Utility functions for the work with suppliers which are functions of the type () => T

Usage example for conversion between Guava and Mango:

// convert a Guava Supplier[T] to a Scala function () => T
import com.google.common.base.{ Supplier => GuavaSupplier }
val fnc: () => T = ...
val supplier: GuavaSupplier[T] = fnc.asJava

// convert a Scala function () => T to a Guava Supplier[T]
val guavaSupplier: GuavaSupplier[T] = ...
val supplier: () => T = guavaSupplier.asScala
Since

0.7

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Suppliers
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. implicit final def asGuavaSupplierConverter[T](fnc: () ⇒ T): AsJava[Supplier[T]]

    Adds an asJava method that wraps a Scala function () => T in a Guava Supplier[T].

    Adds an asJava method that wraps a Scala function () => T in a Guava Supplier[T].

    The returned Guava Supplier[T] forwards all calls of the apply method to the given Scala function () => T.

    fnc

    the Scala function () => T to wrap in a Guava Supplier[T]

    returns

    An object with an asJava method that returns a Guava Supplier[T] view of the argument

  5. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  6. implicit final def asMangoSupplierConverter[T](fnc: Supplier[T]): AsScala[() ⇒ T]

    Adds an asScala method that wraps a Guava Supplier[T] in a Scala function () => T.

    Adds an asScala method that wraps a Guava Supplier[T] in a Scala function () => T.

    The returned Scala function () => T forwards all calls of the apply method to the given Guava Supplier[T].

    returns

    An object with an asScala method that returns a Scala function () => T view of the argument

  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  13. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  14. def memoize[T](f: () ⇒ T): () ⇒ T

    Returns a function which caches the instance retrieved during the first evaluation and returns that value on subsequent evaluations.

    Returns a function which caches the instance retrieved during the first evaluation and returns that value on subsequent evaluations. See: memoization

    The returned function is thread-safe. The functions's serialized form does not contain the cached value, which will be recalculated when the reserialized instance is evaluated.

    If f is an instance created by an earlier call to memoize, it is returned directly.

  15. def memoizeWithExpiration[T](f: () ⇒ T, duration: Long, unit: TimeUnit): () ⇒ T

    Returns a supplier that caches the instance supplied by the delegate and removes the cached value after the specified time has passed.

    Returns a supplier that caches the instance supplied by the delegate and removes the cached value after the specified time has passed. Subsequent evaluations return the cached value if the expiration time has not passed. After the expiration time, a new value is retrieved, cached, and returned. See: memoization

    The returned function is thread-safe. The function's serialized form does not contain the cached value, which will be recalculated when the reserialized instance is evaluated.

    duration

    the length of time after a value is created that it should stop being returned by subsequent evaluations

    unit

    the unit that duration is expressed in

    Exceptions thrown

    IllegalArgumentException if duration is not positive

  16. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  19. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  20. def synchronizedSupplier[T](f: () ⇒ T): () ⇒ T

    Returns a function whose apply() method synchronizes on f before calling it, making it thread-safe.

  21. def toString(): String

    Definition Classes
    AnyRef → Any
  22. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped