com.intellij.psi
Interface PsiSubstitutor

All Known Implementing Classes:
EmptySubstitutor

public interface PsiSubstitutor

Represents a mapping between type parameters and their values.


Field Summary
static PsiSubstitutor EMPTY
          Empty, or natural, substitutor.
static PsiSubstitutor UNKNOWN
           
 
Method Summary
 java.util.Map<PsiTypeParameter,PsiType> getSubstitutionMap()
          Returns the map from type parameters to types used for substution by this substitutor.
 boolean isValid()
          Checks if all types which the substitutor can substitute are valid.
 PsiSubstitutor merge(PsiSubstitutor other)
          Deprecated. use putAll(PsiSubstitutor) instead.
 PsiSubstitutor put(PsiTypeParameter classParameter, PsiType mapping)
          Creates a substitutor instance which provides the specified parameter to type mapping in addition to mappings contained in this substitutor.
 PsiSubstitutor putAll(PsiClass parentClass, PsiType[] mappings)
          Creates a substitutor instance which maps the type parameters of the specified class to the specified types in addition to mappings contained in this substitutor.
 PsiSubstitutor putAll(PsiSubstitutor another)
          Creates a substitutor instance containing all mappings from this substitutor and the specified substitutor.
 PsiType substitute(PsiType type)
          Substitutes type parameters occuring in type with their values.
 PsiType substitute(PsiTypeParameter typeParameter)
          Returns a mapping that this substitutor contains for a given type parameter.
 PsiType substituteAndCapture(PsiType type)
          Substitutes type parameters occuring in type with their values.
 PsiType substituteAndFullCapture(PsiType type)
          Substitutes type parameters occuring in type with their values.
 

Field Detail

EMPTY

static final PsiSubstitutor EMPTY
Empty, or natural, substitutor. For any type parameter T, substitues type T. Example: consider class List<E>. this inside class List has type List with EMPTY substitutor.


UNKNOWN

static final PsiSubstitutor UNKNOWN
Method Detail

substitute

@Nullable
PsiType substitute(PsiTypeParameter typeParameter)
Returns a mapping that this substitutor contains for a given type parameter.

Parameters:
typeParameter - the parameter to return the mapping for.
Returns:
the mapping for the type parameter, or null for a raw type.

substitute

PsiType substitute(PsiType type)
Substitutes type parameters occuring in type with their values. If value for type parameter is null, appropriate erasure is returned.

Parameters:
type - the type to substitute the type parameters for.
Returns:
the result of the substitution.

substituteAndCapture

PsiType substituteAndCapture(PsiType type)
Substitutes type parameters occuring in type with their values. If value for type parameter is null, appropriate erasure is returned. If value of a class type parameter is a wildcard type, captures it in PsiCapturedWildcardType

Parameters:
type - the type to substitute the type parameters for.
Returns:
the result of the substitution.

substituteAndFullCapture

PsiType substituteAndFullCapture(PsiType type)
Substitutes type parameters occuring in type with their values. If value for type parameter is null, appropriate erasure is returned. If value of a type parameter is a wildcard type, captures it in PsiCapturedWildcardType

Parameters:
type - the type to substitute the type parameters for.
Returns:
the result of the substitution.

put

PsiSubstitutor put(PsiTypeParameter classParameter,
                   PsiType mapping)
Creates a substitutor instance which provides the specified parameter to type mapping in addition to mappings contained in this substitutor.

Parameters:
classParameter - the parameter which is mapped.
mapping - the type to which the parameter is mapped.
Returns:
the new substitutor instance.

putAll

PsiSubstitutor putAll(PsiClass parentClass,
                      PsiType[] mappings)
Creates a substitutor instance which maps the type parameters of the specified class to the specified types in addition to mappings contained in this substitutor.

Parameters:
parentClass - the class whose parameters are mapped.
mappings - the types to which the parameters are mapped.
Returns:
the new substitutor instance.

putAll

PsiSubstitutor putAll(PsiSubstitutor another)
Creates a substitutor instance containing all mappings from this substitutor and the specified substitutor.

Parameters:
another - the substitutor to get the mappings from.
Returns:
the new substitutor instance.

merge

PsiSubstitutor merge(PsiSubstitutor other)
Deprecated. use putAll(PsiSubstitutor) instead.


getSubstitutionMap

@NotNull
java.util.Map<PsiTypeParameter,PsiType> getSubstitutionMap()
Returns the map from type parameters to types used for substution by this substitutor.

Returns:
the substitution map instance.

isValid

boolean isValid()
Checks if all types which the substitutor can substitute are valid.

Returns:
true if all types are valid, false otherwise.
See Also:
PsiType.isValid()