Interface TypeEnvironment
-
- All Known Implementing Classes:
CompoundTypeEnvironment,IdentityTypeEnvironment
public interface TypeEnvironmentA typing context that knows how to "resolve" the generic parameters of aType. For example:class Shop<T> { List<T> getCatalog() { ... } }
Consider the type returned by methodclass Bakery extends Shop<Bread> { ... }getCatalog(). There are two possible contexts here. In the context ofShop, the type isList. In the context ofBakery, the type isList. Each of these contexts can be represented by aTypeEnvironment.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Typebind(Type type)Binds as many generic components of the given type as possible in this context.
-
-
-
Method Detail
-
bind
Type bind(Type type)
Binds as many generic components of the given type as possible in this context. Warning: if the returnedTypeis aClass, then it's guaranteed to be a regular JavaClass. In all other cases, this method might return a custom implementation of some interface that extendsType. Be sure not to mix these objects with Java's implementations ofTypeto avoid potential identity problems. This class does not support bindings involving inner classes or upper/lower bounds.- Returns:
- a type where the generic arguments have been replaced by raw classes whenever this is possible.
-
-