Top Description Methods
org.hibernate.annotations.common.reflection.java.generics

public Interface TypeEnvironment

Known Direct Implementers
org.hibernate.annotations.common.reflection.java.generics.ApproximatingTypeEnvironment, org.hibernate.annotations.common.reflection.java.generics.CompoundTypeEnvironment, org.hibernate.annotations.common.reflection.java.generics.IdentityTypeEnvironment, org.hibernate.annotations.common.reflection.java.generics.SimpleTypeEnvironment
Imports
java.lang.reflect.Type

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<T>. In the context of Bakery, the type is List<Bread>. Each of these contexts can be represented by a TypeEnvironment.

Authors
Davide Marchignoli, Paolo Perrotta

Method Summary

Modifier and TypeMethod and Description
public Type

Returns:

a type where the generic arguments have been replaced by raw classes whenever this is possible.
bind
(Type type)

Binds as many generic components of the given type as possible in this context.

Method Detail

bindback to summary
public Type bind(Type type)

Binds as many generic components of the given type as possible in this context.

Warning

if the returned Type is a Class, then it's guaranteed to be a regular Java Class. In all other cases, this method might return a custom implementation of some interface that extends Type. Be sure not to mix these objects with Java's implementations of Type to avoid potential identity problems.

This class does not support bindings involving inner classes or upper/lower bounds.

Returns:Type

a type where the generic arguments have been replaced by raw classes whenever this is possible.