trait
Structural[Mixin] extends Serializable
Type Members
-
abstract
type
Out >: Mixin
Abstract Value Members
-
abstract
def
getClass(): Class[_]
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
def
+(other: String): String
-
def
->[B](y: B): (Structural[Mixin], B)
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
-
-
-
-
-
def
formatted(fmtstr: String): String
-
def
hashCode(): Int
-
final
def
isInstanceOf[T0]: Boolean
-
final
def
structuralize(mixin: Mixin): Out
-
def
toString(): String
-
def
→[B](y: B): (Structural[Mixin], B)
Inherited by implicit conversion any2stringadd from
Structural[Mixin] to any2stringadd[Structural[Mixin]]
Inherited by implicit conversion StringFormat from
Structural[Mixin] to StringFormat[Structural[Mixin]]
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._
Given a class that contains abstract types:
When converting it to a structural type
Then methods on the converted struct should be able to access via reflective call
import scala.language.reflectiveCalls myStruct.self should be(myStruct)
Given a String
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
However, the struct is not a String
"myStruct: String" shouldNot typeCheck