Interface TypeEnvironment
- All Known Implementing Classes:
CompoundTypeEnvironment,IdentityTypeEnvironment
public interface TypeEnvironment
A typing context that knows how to "resolve" the generic parameters of a
Type.
For example:
class Shop<T> {
List<T> getCatalog() { ... }
}
class Bakery extends Shop<Bread> { ... }
Consider the type returned by method getCatalog(). There are
two possible contexts here. In the context of Shop, the type
is List. In the context of Bakery, the
type is List. Each of these contexts can be
represented by a TypeEnvironment.-
Method Summary
-
Method Details
-
bind
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.
-