Trait/Object

com.thoughtworks.feature

Structural

Related Docs: object Structural | package feature

Permalink

trait Structural[Mixin] extends Serializable

A type class that converts a class type to a refinement type

This Structural type class provides an extension method structuralize via implicit view, which can be import as follow:

import com.thoughtworks.feature.Structural.ops._
Source
Structural.scala
Examples:
  1. Given a class that contains abstract types:

    trait Container extends Iterable[String] {
      trait InnerApi
      type Inner <: InnerApi
      def inner: Inner = ???
      type Self0 >: this.type
      def self: Self0 = this
    }
    val container: Container = new Container { def iterator = Iterator.empty }

    When converting it to a structural type

    import scala.language.higherKinds
    val myStruct = container.structuralize

    Then methods on the converted struct should be able to access via reflective call

    import scala.language.reflectiveCalls
    myStruct.self should be(myStruct)
  2. ,
  3. Given a String

    val myString: String = "foo"

    When converting it to a structural type

    val myStruct = myString.structuralize

    Then methods on the converted struct should be able to access via reflective call

    import scala.language.reflectiveCalls
    myStruct.startsWith("f") should be(true)

    However, the struct is not a String

    "myStruct: String" shouldNot typeCheck
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Structural
  2. Serializable
  3. Serializable
  4. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. abstract type Out >: Mixin

    Permalink

Abstract Value Members

  1. abstract def getClass(): Class[_]

    Permalink
    Definition Classes
    Any

Concrete Value Members

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

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

    Permalink
    Definition Classes
    Any
  3. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from Structural[Mixin] to any2stringadd[Structural[Mixin]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (Structural[Mixin], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from Structural[Mixin] to ArrowAssoc[Structural[Mixin]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def ensuring(cond: (Structural[Mixin]) ⇒ Boolean, msg: ⇒ Any): Structural[Mixin]

    Permalink
    Implicit information
    This member is added by an implicit conversion from Structural[Mixin] to Ensuring[Structural[Mixin]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  8. def ensuring(cond: (Structural[Mixin]) ⇒ Boolean): Structural[Mixin]

    Permalink
    Implicit information
    This member is added by an implicit conversion from Structural[Mixin] to Ensuring[Structural[Mixin]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  9. def ensuring(cond: Boolean, msg: ⇒ Any): Structural[Mixin]

    Permalink
    Implicit information
    This member is added by an implicit conversion from Structural[Mixin] to Ensuring[Structural[Mixin]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  10. def ensuring(cond: Boolean): Structural[Mixin]

    Permalink
    Implicit information
    This member is added by an implicit conversion from Structural[Mixin] to Ensuring[Structural[Mixin]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  12. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from Structural[Mixin] to StringFormat[Structural[Mixin]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  13. def hashCode(): Int

    Permalink
    Definition Classes
    Any
  14. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  15. final def structuralize(mixin: Mixin): Out

    Permalink
  16. def toString(): String

    Permalink
    Definition Classes
    Any
  17. def [B](y: B): (Structural[Mixin], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from Structural[Mixin] to ArrowAssoc[Structural[Mixin]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from Serializable

Inherited from Serializable

Inherited from Any

Inherited by implicit conversion any2stringadd from Structural[Mixin] to any2stringadd[Structural[Mixin]]

Inherited by implicit conversion StringFormat from Structural[Mixin] to StringFormat[Structural[Mixin]]

Inherited by implicit conversion Ensuring from Structural[Mixin] to Ensuring[Structural[Mixin]]

Inherited by implicit conversion ArrowAssoc from Structural[Mixin] to ArrowAssoc[Structural[Mixin]]

Ungrouped