trait TypeVarReplace[A] extends AnyRef
Замена переменной Типа.
Актуально когда есть параметризированный тип, например List с параметром A.
List[A] {
add( item : A )
}
Для правильной проверке типов и соответ вывода типов, необходима процедура замены переменных на реальные значения.
Для примера возьмем тип User:
User {
name : String
enabled : Boolean
}
Создадим переменную типа List, которая может создержать только элементы типа User.
Для java кода это так: var userList = new List<User>
В нашем случае это такой код:
val userList = new GenericInstance( Map("A"->userType), listType )
Тогда при вызове userList.add( something )
будет выведен новый тип для userList:
List {
add( item: User )
}
Этот вывод новго типа осуществляется за счет TypeVarReplace.
- A
Объект реализующий TypeVarReplace
- Alphabetic
- By Inheritance
- TypeVarReplace
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
typeVarReplace(recipe: (TypeVariable) ⇒ Option[Type]): A
Замена переменных
Замена переменных
- recipe
правило замены
- returns
новый тип
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
typeVarReplace(recipe: (String, Type)*): A
Замена переменных
Замена переменных
- recipe
правило замены
- returns
новый тип
- def typeVarReplacer(recipe: Consumer[TypeVarReplacer]): A
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
object
typeVarBake
Замена переменных
Deprecated Value Members
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated @deprecated
- Deprecated
(Since version ) see corresponding Javadoc for more information.