public abstract class PsiType extends java.lang.Object implements PsiAnnotationOwner, java.lang.Cloneable, JvmType
Modifier and Type | Class and Description |
---|---|
protected static class |
PsiType.Stub |
Modifier and Type | Field and Description |
---|---|
static ArrayFactory<PsiType> |
ARRAY_FACTORY |
static PsiPrimitiveType |
BOOLEAN |
static PsiPrimitiveType |
BYTE |
static PsiPrimitiveType |
CHAR |
static PsiPrimitiveType |
DOUBLE |
static PsiType[] |
EMPTY_ARRAY |
static PsiPrimitiveType |
FLOAT |
static PsiPrimitiveType |
INT |
static PsiPrimitiveType |
LONG |
static PsiPrimitiveType |
NULL |
static PsiPrimitiveType |
SHORT |
static PsiPrimitiveType |
VOID |
Modifier | Constructor and Description |
---|---|
protected |
PsiType(PsiAnnotation [] annotations)
Constructs a PsiType with given annotations
|
protected |
PsiType(TypeAnnotationProvider annotations)
Constructs a PsiType that will take its annotations from the given annotation provider.
|
Modifier and Type | Method and Description |
---|---|
abstract <A> A |
accept(PsiTypeVisitor<A> visitor)
Passes the type to the specified visitor.
|
PsiAnnotation |
addAnnotation(java.lang.String qualifiedName)
Adds a new annotation to this owner.
|
PsiType |
annotate(TypeAnnotationProvider provider) |
static PsiType [] |
createArray(int count) |
PsiArrayType |
createArrayType()
Creates array type with this type as a component.
|
PsiArrayType |
createArrayType(PsiAnnotation... annotations)
Deprecated.
|
abstract boolean |
equalsToText(java.lang.String text)
Checks if the specified string is equivalent to the canonical text of the type.
|
PsiAnnotation |
findAnnotation(java.lang.String qualifiedName)
Searches the owner for an annotation with the specified fully qualified name
and returns one if it is found.
|
TypeAnnotationProvider |
getAnnotationProvider() |
PsiAnnotation [] |
getAnnotations()
Returns the list of annotations syntactically contained in the element.
|
PsiAnnotation [] |
getApplicableAnnotations() |
int |
getArrayDimensions()
Returns the number of array dimensions for the type.
|
abstract java.lang.String |
getCanonicalText()
Same as
getCanonicalText(false) . |
java.lang.String |
getCanonicalText(boolean annotated)
Returns canonical representation of the type (all references fully-qualified).
|
PsiType |
getDeepComponentType()
Returns the innermost component type for an array type.
|
java.lang.String |
getInternalCanonicalText()
Return canonical text of the type with some internal details added for presentational purposes.
|
static PsiClassType |
getJavaLangClass(PsiManager manager,
GlobalSearchScope resolveScope)
Returns the class type for the java.lang.Class class.
|
static PsiClassType |
getJavaLangError(PsiManager manager,
GlobalSearchScope resolveScope)
Returns the class type for the java.lang.Error class.
|
static PsiClassType |
getJavaLangObject(PsiManager manager,
GlobalSearchScope resolveScope)
Returns the class type for the java.lang.Object class.
|
static PsiClassType |
getJavaLangRuntimeException(PsiManager manager,
GlobalSearchScope resolveScope)
Returns the class type for the java.lang.RuntimeException class.
|
static PsiClassType |
getJavaLangString(PsiManager manager,
GlobalSearchScope resolveScope)
Returns the class type for the java.lang.String class.
|
static PsiClassType |
getJavaLangThrowable(PsiManager manager,
GlobalSearchScope resolveScope)
Returns the class type for the java.lang.Throwable class.
|
abstract java.lang.String |
getPresentableText()
Same as
getPresentableText(false) . |
java.lang.String |
getPresentableText(boolean annotated)
Returns text of the type that can be presented to a user (references normally non-qualified).
|
abstract GlobalSearchScope |
getResolveScope()
Returns the scope in which the reference to the underlying class of a class type is searched.
|
abstract PsiType [] |
getSuperTypes()
Returns the list of superclass types for a class type.
|
static PsiClassType |
getTypeByName(java.lang.String qName,
Project project,
GlobalSearchScope resolveScope)
Returns the class type for qualified class name.
|
boolean |
isAssignableFrom(PsiType type) |
boolean |
isConvertibleFrom(PsiType type)
Checks whether values of type
type can be casted to this type. |
abstract boolean |
isValid()
Checks if the type is currently valid.
|
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
hasAnnotation
public static final PsiPrimitiveType BYTE
public static final PsiPrimitiveType CHAR
public static final PsiPrimitiveType DOUBLE
public static final PsiPrimitiveType FLOAT
public static final PsiPrimitiveType INT
public static final PsiPrimitiveType LONG
public static final PsiPrimitiveType SHORT
public static final PsiPrimitiveType BOOLEAN
public static final PsiPrimitiveType VOID
public static final PsiPrimitiveType NULL
public static final PsiType[] EMPTY_ARRAY
public static final ArrayFactory<PsiType> ARRAY_FACTORY
protected PsiType(PsiAnnotation [] annotations)
protected PsiType(TypeAnnotationProvider annotations)
public static PsiType [] createArray(int count)
public PsiType annotate(TypeAnnotationProvider provider)
public PsiArrayType createArrayType()
@Deprecated public PsiArrayType createArrayType(PsiAnnotation... annotations)
annotate(TypeAnnotationProvider)
public java.lang.String getPresentableText(boolean annotated)
public abstract java.lang.String getPresentableText()
getPresentableText(false)
.public java.lang.String getCanonicalText(boolean annotated)
public abstract java.lang.String getCanonicalText()
getCanonicalText(false)
.public java.lang.String getInternalCanonicalText()
public abstract boolean isValid()
PsiElement.isValid()
public boolean isAssignableFrom(PsiType type)
type
can be assigned to rvalues of this type.public boolean isConvertibleFrom(PsiType type)
type
can be casted to this type.public abstract boolean equalsToText(java.lang.String text)
text
- the text to compare with.public static PsiClassType getTypeByName(java.lang.String qName, Project project, GlobalSearchScope resolveScope)
qName
- qualified class name.resolveScope
- the scope in which the class is searched.public static PsiClassType getJavaLangObject(PsiManager manager, GlobalSearchScope resolveScope)
manager
- the PSI manager used to create the class type.resolveScope
- the scope in which the class is searched.public static PsiClassType getJavaLangClass(PsiManager manager, GlobalSearchScope resolveScope)
manager
- the PSI manager used to create the class type.resolveScope
- the scope in which the class is searched.public static PsiClassType getJavaLangThrowable(PsiManager manager, GlobalSearchScope resolveScope)
manager
- the PSI manager used to create the class type.resolveScope
- the scope in which the class is searched.public static PsiClassType getJavaLangString(PsiManager manager, GlobalSearchScope resolveScope)
manager
- the PSI manager used to create the class type.resolveScope
- the scope in which the class is searched.public static PsiClassType getJavaLangError(PsiManager manager, GlobalSearchScope resolveScope)
manager
- the PSI manager used to create the class type.resolveScope
- the scope in which the class is searched.public static PsiClassType getJavaLangRuntimeException(PsiManager manager, GlobalSearchScope resolveScope)
manager
- the PSI manager used to create the class type.resolveScope
- the scope in which the class is searched.public abstract <A> A accept(PsiTypeVisitor<A> visitor)
visitor
- the visitor to accept the type.public final int getArrayDimensions()
public final PsiType getDeepComponentType()
this
if the type is not
an array type.public abstract GlobalSearchScope getResolveScope()
public abstract PsiType [] getSuperTypes()
public final TypeAnnotationProvider getAnnotationProvider()
public PsiAnnotation [] getAnnotations()
PsiAnnotationOwner
getAnnotations
in interface JvmType
getAnnotations
in interface PsiAnnotationOwner
getAnnotationProvider()
to retrieve the annotations.AnnotatedElement.getAnnotations()
public PsiAnnotation findAnnotation(java.lang.String qualifiedName)
PsiAnnotationOwner
findAnnotation
in interface PsiAnnotationOwner
qualifiedName
- the fully qualified name of the annotation to find.public PsiAnnotation addAnnotation(java.lang.String qualifiedName)
PsiAnnotationOwner
addAnnotation
in interface PsiAnnotationOwner
qualifiedName
- qualifiedNamepublic PsiAnnotation [] getApplicableAnnotations()
getApplicableAnnotations
in interface PsiAnnotationOwner
public java.lang.String toString()
toString
in class java.lang.Object