Trait

com.eharmony.aloha.semantics

MorphableSemantics

Related Doc: package semantics

Permalink

trait MorphableSemantics[M[_] <: Semantics[_], A] extends Semantics[A]

A version of Semantics that can morph into other instances of the same structure but with a different type parameter.

An example:

case class X[A]() extends MorphableSemantics[X, A] {
  // ...
  def morph[B: RefInfo]: Option[X[B]] = Some(X[B]())
}

Notice for class X, that the M type constructor is X and the A is the same for the second type parameter of MorphableSemantics as for the type parameter in Semantics.

This can be use like the following:

import com.eharmony.aloha.reflect.RefInfo

val xF = X[Float]
val riD = implicitly[RefInfo[Double]]
val xDo: Option[X[Double]] = xF.morph[Double]
val xDo1: Option[X[Double]] = xF.morph(riD)

or use it generically:

def morph[M[_] <: Semantics[_], A, B: RefInfo](m: MorphableSemantics[M, A]): Option[Semantics[B]] = {
  m.morph[B]
}

val sDO: Option[Semantics[Double]] = morph(xF)
M

a type constructor providing the structure of the Semantics. This will most likely always be the concrete subclass of Semantics that implements MorphableSemantics.

A

the type parameter to which M is applied for this instance of Semantics, also the type parameter for the Semantics.

Linear Supertypes
Semantics[A], Closeable, AutoCloseable, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. MorphableSemantics
  2. Semantics
  3. Closeable
  4. AutoCloseable
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def accessorFunctionNames: Seq[String]

    Permalink

    Returns the string representations of all of the data "variables" used by functions created from this Semantics object.

    Returns the string representations of all of the data "variables" used by functions created from this Semantics object.

    Definition Classes
    Semantics
  2. abstract def close(): Unit

    Permalink
    Definition Classes
    Closeable → AutoCloseable
    Annotations
    @throws( classOf[java.io.IOException] )
  3. abstract def createFunction[B](codeSpec: String, default: Option[B] = None)(implicit arg0: RefInfo[B]): Either[Seq[String], GenAggFunc[A, B]]

    Permalink

    Create a function from A to B.

    Create a function from A to B.

    B

    The return type of the function.

    codeSpec

    specification for a function to be produced by this semantics.

    default

    a default value in the case that the function would produce an optional type.

    Definition Classes
    Semantics
  4. abstract def morph[B](implicit ri: RefInfo[B]): Option[MorphableSemantics[M, B]]

    Permalink

    Attempt to morph this MorphableSemantics into a new one with the same structure.

    Attempt to morph this MorphableSemantics into a new one with the same structure.

    The new MorphableSemantics will have the same structure (as dictated by the M type parameter) but with a different second parameter. This new instance must also be a Semantics[B]. It can be the case that a specific implementation of MorphableSemantics doesn't allow for all B, in which case a None can be returned.

    B

    input type for the new MorphableSemantics instance that might be created. A MorphableSemantics instance may choose not allow morphing to all B. In that case, a None will be returned.

    ri

    reflection information that may be necessary to determine whether to create the MorphableSemantics that was requested.

  5. abstract def refInfoA: RefInfo[A]

    Permalink

    returns

    a com.eharmony.aloha.reflect.RefInfo for input type A.

    Definition Classes
    Semantics

Concrete Value Members

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

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

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

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

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

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

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

    Permalink
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  13. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  14. final def notifyAll(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  16. def toString(): String

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Semantics[A]

Inherited from Closeable

Inherited from AutoCloseable

Inherited from AnyRef

Inherited from Any

Ungrouped