Package

com.avsystem.commons

misc

Permalink

package misc

Visibility
  1. Public
  2. All

Type Members

  1. final case class Boxing[-A, +B](fun: (A) ⇒ B) extends AnyVal with Product with Serializable

    Permalink

    Author: ghik Created: 07/01/16.

  2. trait Delegation[A, B] extends AnyRef

    Permalink

    A typeclass which witnesses that type A can be wrapped into trait or abstract class B

  3. trait LowPrioBoxing extends AnyRef

    Permalink
  4. trait LowPrioUnboxing extends AnyRef

    Permalink
  5. final class NOpt[+A] extends AnyVal with Serializable

    Permalink

    Like Opt but does have a counterpart for Some(null).

  6. trait NamedEnum extends Any

    Permalink
  7. trait NamedEnumCompanion[T <: NamedEnum] extends SealedEnumCompanion[T]

    Permalink

    Base trait for companion objects of sealed traits that serve as named enums

  8. final class Opt[+A] extends AnyVal with Serializable

    Permalink

    Like Option but avoids boxing and treats null as no value.

    Like Option but avoids boxing and treats null as no value. Therefore, there is no equivalent for Some(null).

    Author: ghik Created: 07/01/16.

  9. final class OptArg[+A] extends AnyVal with Serializable

    Permalink

    OptArg is like Opt except it's intended to be used to type-safely express optional method/constructor parameters while at the same time avoiding having to explicitly wrap arguments when passing them (thanks to the implicit conversion from A to OptArg[A]).

    OptArg is like Opt except it's intended to be used to type-safely express optional method/constructor parameters while at the same time avoiding having to explicitly wrap arguments when passing them (thanks to the implicit conversion from A to OptArg[A]). For example:

    def takesMaybeString(str: OptArg[String] = OptArg.Empty) = ???
    
    takesMaybeString()         // default empty value is used
    takesMaybeString("string") // no explicit wrapping into OptArg required

    Note that like Opt, OptArg assumes its underlying value to be non-null and null is translated into OptArg.Empty.
    It is strongly recommended that OptArg type is used ONLY in signatures where implicit conversion A => OptArg[A] is intended to work. You should not use OptArg as a general-purpose "optional value" type - other types like Opt, NOpt and scala.Option serve that purpose. For this reason OptArg deliberately does not have any "transforming" methods like map, flatMap, orElse, etc. Instead it's recommended that OptArg is converted to Opt, NOpt or scala.Option as soon as possible (using toOpt, toNOpt and toOption methods).

  10. final class OptRef[+A >: Null] extends AnyVal with Serializable

    Permalink

    Like Opt but has better Java interop thanks to the fact that wrapped value has type A instead of Any.

    Like Opt but has better Java interop thanks to the fact that wrapped value has type A instead of Any. For example, Scala method defined like this:

    def takeMaybeString(str: OptRef[String]): Unit

    will be seen by Java as:

    public void takeMaybeString(String str);

    and null will be used to represent absence of value.

    This comes at the cost of A having to be a nullable type. Also, empty value is represented internally using null which unfortunately makes OptRef suffer from SI-7396 (hashCode fails on OptRef.Empty which means that you can't add OptRef values into hash sets or use them as hash map keys).

    Author: ghik Created: 07/01/16.

  11. trait OrderedEnum extends Any

    Permalink

    Trait to be extended by enums whose values are ordered by declaration order.

    Trait to be extended by enums whose values are ordered by declaration order. Ordering is derived from SourceInfo object, which is typically accepted as an implicit, e.g.

    sealed abstract class MyOrderedEnum(implicit val sourceInfo: SourceInfo) extends OrderedEnum
    object MyOrderedEnum {
      case object First extends MyOrderedEnum
      case object Second extends MyOrderedEnum
      case object Third extends MyOrderedEnum
    
      val values: List[MyOrderedEnum] = caseObjects
    }

    In the example above, values is guaranteed to return First, Second and Third objects in exactly that order.

  12. abstract class SamCompanion[T, F] extends AnyRef

    Permalink

    Author: ghik Created: 23/11/15.

  13. trait SealedEnumCompanion[T] extends AnyRef

    Permalink

    Base trait for companion objects of sealed traits that serve as enums, i.e.

    Base trait for companion objects of sealed traits that serve as enums, i.e. their only values are case objects. For example:

    sealed trait SomeEnum
    object SomeEnum extends SealedEnumCompanion[SomeEnum] {
      case object FirstValue extends SomeEnum
      case object SecondValue extends SomeEnum
      case object ThirdValue extends SomeEnum
    
      // it's important to give explicit type here
      val values: List[SomeEnum] = caseObjects
    }
  14. case class SourceInfo(filePath: String, fileName: String, offset: Int, line: Int, column: Int, lineContent: String, enclosingSymbols: List[String]) extends Product with Serializable

    Permalink

    Macro-materialized implicit value that provides information about callsite source file position.

    Macro-materialized implicit value that provides information about callsite source file position. It can be used in runtime for logging and debugging purposes. Similar to Scalactic's Position, but contains more information.

  15. abstract class TypedKey[T] extends AnyRef

    Permalink

    Base class for sealed enums which can be used as key type for a TypedMap.

    Base class for sealed enums which can be used as key type for a TypedMap. It also ensures that the TypedMap using TypedKey as a key type will always have a GenCodec.

  16. trait TypedKeyCompanion[K[X] <: TypedKey[X]] extends SealedEnumCompanion[K[_]]

    Permalink
  17. final class TypedMap[K[_]] extends AnyVal

    Permalink

    Author: ghik Created: 21/04/16.

  18. final case class Unboxing[+A, -B](fun: (B) ⇒ A) extends AnyVal with Product with Serializable

    Permalink

Value Members

  1. object Bidirectional

    Permalink

    Creates reversed partial function.

  2. object Boxing extends LowPrioBoxing with Serializable

    Permalink
  3. object Delegation

    Permalink
  4. object Implicits

    Permalink

    Author: ghik Created: 19/09/16.

  5. object NOpt extends Serializable

    Permalink
  6. object Opt extends Serializable

    Permalink
  7. object OptArg extends Serializable

    Permalink
  8. object OptRef extends Serializable

    Permalink
  9. object OrderedEnum

    Permalink
  10. object Sam

    Permalink

    Author: ghik Created: 24/11/15.

  11. object SamCompanion

    Permalink
  12. object SealedUtils

    Permalink

    Author: ghik Created: 11/12/15.

  13. object SourceInfo extends Serializable

    Permalink
  14. object TypedMap

    Permalink
  15. object Unboxing extends LowPrioUnboxing with Serializable

    Permalink

Ungrouped