trait
Factory[Output] extends AnyRef
Type Members
-
abstract
type
Constructor
Abstract Value Members
-
abstract
val
newInstance: Constructor
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
def
+(other: String): String
-
def
->[B](y: B): (Factory[Output], B)
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
def
ensuring(cond: (Factory[Output]) ⇒ Boolean, msg: ⇒ Any): Factory[Output]
-
def
ensuring(cond: (Factory[Output]) ⇒ Boolean): Factory[Output]
-
def
ensuring(cond: Boolean, msg: ⇒ Any): Factory[Output]
-
def
ensuring(cond: Boolean): Factory[Output]
-
-
-
def
finalize(): Unit
-
def
formatted(fmtstr: String): String
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
final
def
isInstanceOf[T0]: Boolean
-
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
-
def
→[B](y: B): (Factory[Output], B)
Inherited by implicit conversion any2stringadd from
Factory[Output] to any2stringadd[Factory[Output]]
Inherited by implicit conversion StringFormat from
Factory[Output] to StringFormat[Factory[Output]]
Inherited by implicit conversion Ensuring from
Factory[Output] to Ensuring[Factory[Output]]
Inherited by implicit conversion ArrowAssoc from
Factory[Output] to ArrowAssoc[Factory[Output]]
A factory to create new instances, especially dynamic mix-ins.
Author:
杨博 (Yang Bo) <[email protected]>
Given a trait that has an abstract member.
When creating a factory for the trait.
val factory = Factory[Foo]
Then the newInstance method of the factory should accept one parameter.
Given two traits that have no abstract member.
When creating a factory for mix-in type of the two types.
Then the newInstance method of the factory should accept no parameters.
Given a trait that contains an abstract method annotated as @inject.
When creating a factory for the trait
Then the
@inject
method will be replaced to an implicit value.It will not compile if no implicit value found. For example,
Foo[Symbol]
requires an implicit value of typeOrdering[Symbol]
, which is not availble."Factory[Foo[Symbol]]" shouldNot compile
The factory may contain abstract parameters of abstract types