public final class PsiElementFactoryImpl extends PsiJavaParserFacadeImpl implements PsiElementFactory
PsiElementFactory.SERVICE
myManager, REFERENCE
Constructor and Description |
---|
PsiElementFactoryImpl(Project project) |
Modifier and Type | Method and Description |
---|---|
PsiAnnotation |
createAnnotationFromText(java.lang.String annotationText,
PsiElement context)
Creates an annotation from the specified text.
|
PsiAnnotation |
createAnnotationFromText(java.lang.String annotationText,
PsiElement context,
boolean markGenerated) |
PsiClass |
createAnnotationType(java.lang.String name)
Creates an empty annotation type with the specified name.
|
PsiCatchSection |
createCatchSection(PsiType exceptionType,
java.lang.String exceptionName,
PsiElement context)
Creates a
catch section for catching an exception of the specified
type and name. |
PsiClass |
createClass(java.lang.String name)
Creates an empty class with the specified name.
|
PsiClassInitializer |
createClassInitializer()
Creates an empty class initializer block.
|
PsiJavaCodeReferenceElement |
createClassReferenceElement(PsiClass aClass)
Creates a reference element resolving to the specified class.
|
PsiCodeBlock |
createCodeBlock()
Creates an empty Java code block.
|
PsiCodeBlock |
createCodeBlockFromText(java.lang.String text,
PsiElement context)
Creates a Java code block from the specified text.
|
PsiMethod |
createConstructor()
Creates an empty constructor.
|
PsiMethod |
createConstructor(java.lang.String name)
Creates an empty constructor with a given name.
|
PsiMethod |
createConstructor(java.lang.String name,
PsiElement context)
Creates an empty constructor with a given name in the given context.
|
PsiElement |
createDummyHolder(java.lang.String text,
IElementType type,
PsiElement context)
Create a lightweight PsiElement of given element type in a lightweight non-physical PsiFile (aka DummyHolder) in a given context.
|
PsiClass |
createEnum(java.lang.String name)
Creates an empty enum with the specified name.
|
PsiEnumConstant |
createEnumConstantFromText(java.lang.String text,
PsiElement context) |
PsiExpression |
createExpressionFromText(java.lang.String text,
PsiElement context)
Creates a Java expression from the specified text.
|
PsiField |
createField(java.lang.String name,
PsiType type)
Creates a field with the specified name and type.
|
PsiField |
createFieldFromText(java.lang.String text,
PsiElement context)
Creates a Java field from the specified text.
|
PsiJavaCodeReferenceElement |
createFQClassNameReferenceElement(java.lang.String qName,
GlobalSearchScope resolveScope)
Creates a reference element resolving to the class with the specified name
in the specified search scope.
|
PsiIdentifier |
createIdentifier(java.lang.String text)
Creates a Java identifier with the specified text.
|
PsiImportStatement |
createImportStatement(PsiClass aClass)
Creates an import statement for importing the specified class.
|
PsiImportStatement |
createImportStatementOnDemand(java.lang.String packageName)
Creates an on-demand import statement for importing classes from the package with the specified name.
|
PsiImportStaticStatement |
createImportStaticStatement(PsiClass aClass,
java.lang.String memberName)
Creates an
import static statement for importing the specified member
from the specified class. |
PsiClass |
createInterface(java.lang.String name)
Creates an empty interface with the specified name.
|
PsiKeyword |
createKeyword(java.lang.String text)
Creates a Java keyword with the specified text.
|
PsiKeyword |
createKeyword(java.lang.String keyword,
PsiElement context) |
PsiMethod |
createMethod(java.lang.String name,
PsiType returnType)
Creates an empty method with the specified name and return type.
|
PsiMethod |
createMethod(java.lang.String name,
PsiType returnType,
PsiElement context)
Creates an empty method with the specified name and return type in the given context.
|
PsiMethod |
createMethodFromText(java.lang.String text,
PsiElement context,
LanguageLevel level)
Creates a Java method from the specified text with the specified language level.
|
PsiJavaCodeReferenceElement |
createPackageReferenceElement(PsiPackage aPackage)
Creates a reference element resolving to the specified package.
|
PsiJavaCodeReferenceElement |
createPackageReferenceElement(java.lang.String packageName)
Creates a reference element resolving to the package with the specified name.
|
PsiPackageStatement |
createPackageStatement(java.lang.String name)
Creates a package statement for the specified package name.
|
PsiParameter |
createParameter(java.lang.String name,
PsiType type)
Creates a parameter with the specified name and type.
|
PsiParameter |
createParameter(java.lang.String name,
PsiType type,
PsiElement context)
Creates a parameter with the specified name and type in the given context.
|
PsiParameter |
createParameterFromText(java.lang.String text,
PsiElement context)
Creates a Java method parameter from the specified text.
|
PsiParameterList |
createParameterList(java.lang.String [] names,
PsiType [] types)
Creates a parameter list from the specified parameter names and types.
|
PsiDocTag |
createParamTag(java.lang.String parameterName,
java.lang.String description)
Creates a PSI element for the "@param" JavaDoc tag.
|
PsiPrimitiveType |
createPrimitiveType(java.lang.String text)
Returns the primitive type instance for the specified type name.
|
PsiSubstitutor |
createRawSubstitutor(PsiSubstitutor baseSubstitutor,
PsiTypeParameter [] typeParameters) |
PsiSubstitutor |
createRawSubstitutor(PsiTypeParameterListOwner owner)
Creates a substitutor for the specified class which replaces all type parameters
with their corresponding raw types.
|
PsiJavaCodeReferenceElement |
createReferenceElementByFQClassName(java.lang.String qName,
GlobalSearchScope resolveScope)
Creates a reference element resolving to the class with the specified name
in the specified search scope.
|
PsiJavaCodeReferenceElement |
createReferenceElementByType(PsiClassType type)
Creates a reference element resolving to the specified class type.
|
PsiReferenceExpression |
createReferenceExpression(PsiClass aClass)
Creates a reference expression resolving to the specified class.
|
PsiReferenceExpression |
createReferenceExpression(PsiPackage aPackage)
Creates a reference expression resolving to the specified package.
|
PsiReferenceList |
createReferenceList(PsiJavaCodeReferenceElement [] references)
Creates a reference list element from the specified array of references.
|
PsiResourceVariable |
createResourceVariable(java.lang.String name,
PsiType type,
PsiExpression initializer,
PsiElement context)
Creates a resource variable (which can be inserted into the resource list of try-with-resources statement)
with the specified name, type and initializer
|
PsiStatement |
createStatementFromText(java.lang.String text,
PsiElement context)
Creates a Java statement from the specified text.
|
PsiSubstitutor |
createSubstitutor(java.util.Map<PsiTypeParameter,PsiType> map)
Creates a substitutor which uses the specified mapping between type parameters and types.
|
PsiClassType |
createType(PsiClass aClass)
Creates a class type for the specified class.
|
PsiClassType |
createType(PsiClass resolve,
PsiSubstitutor substitutor)
Creates a class type for the specified class, using the specified substitutor
to replace generic type parameters on the class.
|
PsiClassType |
createType(PsiClass resolve,
PsiSubstitutor substitutor,
LanguageLevel languageLevel)
Creates a class type for the specified class, using the specified substitutor
to replace generic type parameters on the class.
|
PsiClassType |
createType(PsiClass aClass,
PsiType... parameters) |
PsiClassType |
createType(PsiClass aClass,
PsiType parameter) |
PsiClassType |
createType(PsiJavaCodeReferenceElement classReference)
Creates a class type for the specified reference pointing to a class.
|
PsiClassType |
createTypeByFQClassName(java.lang.String qName)
|
PsiClassType |
createTypeByFQClassName(java.lang.String qName,
GlobalSearchScope resolveScope)
Creates a class type referencing a class with the specified class name in the specified
search scope.
|
PsiTypeElement |
createTypeElement(PsiType psiType)
Creates a type element referencing the specified type.
|
PsiType |
createTypeFromText(java.lang.String text,
PsiElement context)
Creates a Java type from the specified text.
|
PsiTypeParameter |
createTypeParameter(java.lang.String name,
PsiClassType [] superTypes)
Creates new type parameter with the specified name and super types.
|
PsiTypeParameter |
createTypeParameterFromText(java.lang.String text,
PsiElement context)
Creates a type parameter from the specified text.
|
PsiTypeParameterList |
createTypeParameterList()
Creates an empty type parameter list.
|
PsiDeclarationStatement |
createVariableDeclarationStatement(java.lang.String name,
PsiType type,
PsiExpression initializer)
Creates a local variable declaration statement with the specified name, type and initializer,
optionally without reformatting the declaration.
|
PsiDeclarationStatement |
createVariableDeclarationStatement(java.lang.String name,
PsiType type,
PsiExpression initializer,
PsiElement context)
Creates a local variable declaration statement with the specified name, type and initializer,
optionally without reformatting the declaration.
|
PsiClass |
getArrayClass(LanguageLevel languageLevel)
Returns a synthetic Java class containing methods which are defined on Java arrays.
|
PsiClassType |
getArrayClassType(PsiType componentType,
LanguageLevel languageLevel)
Returns the class type for a synthetic Java class containing methods which
are defined on Java arrays with the specified element type.
|
boolean |
isValidClassName(java.lang.String name)
Checks whether the name is a valid class name in the current language.
|
boolean |
isValidFieldName(java.lang.String name)
Checks whether the name is a valid field name in the current language.
|
boolean |
isValidLocalVariableName(java.lang.String name)
Checks whether the name is a valid local variable name in the current language.
|
boolean |
isValidMethodName(java.lang.String name)
Checks whether the name is a valid method name in the current language.
|
boolean |
isValidParameterName(java.lang.String name)
Checks whether the name is a valid parameter name in the current language.
|
createClassFromText, createCommentFromText, createDocCommentFromText, createDocCommentFromText, createDocTagFromText, createDummyJavaFile, createMethodFromText, createModuleFromText, createModuleReferenceFromText, createModuleStatementFromText, createPrimitiveTypeFromText, createRecord, createRecordHeaderFromText, createReferenceFromText, createResourceFromText, createTypeElementFromText, getPrimitiveType, level
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createRecord, getInstance
createClassFromText, createCommentFromText, createDocCommentFromText, createDocCommentFromText, createDocTagFromText, createMethodFromText, createModuleFromText, createModuleFromText, createModuleReferenceFromText, createModuleStatementFromText, createPrimitiveTypeFromText, createRecordHeaderFromText, createReferenceFromText, createResourceFromText, createTypeElementFromText
createDocCommentFromText, createMethodFromText
public PsiElementFactoryImpl(Project project)
public PsiClass getArrayClass(LanguageLevel languageLevel)
PsiElementFactory
getArrayClass
in interface PsiElementFactory
languageLevel
- language level used to construct array class.public PsiClassType getArrayClassType(PsiType componentType, LanguageLevel languageLevel)
PsiElementFactory
getArrayClassType
in interface PsiElementFactory
languageLevel
- language level used to construct array class.public PsiClassType createType(PsiClass resolve, PsiSubstitutor substitutor)
PsiElementFactory
createType
in interface JVMElementFactory
createType
in interface PsiElementFactory
public PsiClassType createType(PsiClass resolve, PsiSubstitutor substitutor, LanguageLevel languageLevel)
PsiElementFactory
createType
in interface JVMElementFactory
createType
in interface PsiElementFactory
resolve
- the class for which the class type is created.substitutor
- the substitutor to use.languageLevel
- to memorize language level for allowing/prohibiting boxing/unboxing.public PsiClass createClass(java.lang.String name) throws IncorrectOperationException
PsiElementFactory
createClass
in interface JVMElementFactory
createClass
in interface PsiElementFactory
IncorrectOperationException
- if name
is not a valid Java identifier.public PsiClass createInterface(java.lang.String name) throws IncorrectOperationException
PsiElementFactory
createInterface
in interface JVMElementFactory
createInterface
in interface PsiElementFactory
IncorrectOperationException
- if name
is not a valid Java identifier.public PsiClass createEnum(java.lang.String name) throws IncorrectOperationException
PsiElementFactory
createEnum
in interface JVMElementFactory
createEnum
in interface PsiElementFactory
IncorrectOperationException
- if name
is not a valid Java identifier.public PsiClass createAnnotationType(java.lang.String name) throws IncorrectOperationException
PsiElementFactory
createAnnotationType
in interface JVMElementFactory
createAnnotationType
in interface PsiElementFactory
IncorrectOperationException
- if name
is not a valid Java identifier.public PsiTypeElement createTypeElement(PsiType psiType)
PsiElementFactory
createTypeElement
in interface PsiElementFactory
public PsiJavaCodeReferenceElement createReferenceElementByType(PsiClassType type)
PsiElementFactory
createReferenceElementByType
in interface JVMElementFactory
createReferenceElementByType
in interface PsiElementFactory
type
- the class type to create the reference to.public PsiTypeParameterList createTypeParameterList()
JVMElementFactory
createTypeParameterList
in interface JVMElementFactory
public PsiTypeParameter createTypeParameter(java.lang.String name, PsiClassType [] superTypes)
JVMElementFactory
createTypeParameter
in interface JVMElementFactory
public PsiField createField(java.lang.String name, PsiType type) throws IncorrectOperationException
PsiElementFactory
createField
in interface JVMElementFactory
createField
in interface PsiElementFactory
IncorrectOperationException
- name
is not a valid Java identifier
or type
represents an invalid type.public PsiMethod createMethod(java.lang.String name, PsiType returnType) throws IncorrectOperationException
PsiElementFactory
createMethod
in interface JVMElementFactory
createMethod
in interface PsiElementFactory
IncorrectOperationException
- name
is not a valid Java identifier
or type
represents an invalid type.public PsiMethod createMethod(java.lang.String name, PsiType returnType, PsiElement context) throws IncorrectOperationException
JVMElementFactory
createMethod
in interface JVMElementFactory
IncorrectOperationException
- name
is not a valid Java identifier or type
represents an invalid type.public PsiMethod createConstructor()
PsiElementFactory
createConstructor
in interface JVMElementFactory
createConstructor
in interface PsiElementFactory
public PsiMethod createConstructor(java.lang.String name)
PsiElementFactory
createConstructor
in interface JVMElementFactory
createConstructor
in interface PsiElementFactory
public PsiMethod createConstructor(java.lang.String name, PsiElement context)
JVMElementFactory
createConstructor
in interface JVMElementFactory
public PsiClassInitializer createClassInitializer() throws IncorrectOperationException
PsiElementFactory
createClassInitializer
in interface JVMElementFactory
createClassInitializer
in interface PsiElementFactory
IncorrectOperationException
- in case of an internal error.public PsiParameter createParameter(java.lang.String name, PsiType type) throws IncorrectOperationException
PsiElementFactory
createParameter
in interface JVMElementFactory
createParameter
in interface PsiElementFactory
IncorrectOperationException
- name
is not a valid Java identifier
or type
represents an invalid type.public PsiParameter createParameter(java.lang.String name, PsiType type, PsiElement context) throws IncorrectOperationException
JVMElementFactory
createParameter
in interface JVMElementFactory
IncorrectOperationException
- name
is not a valid Java identifier or type
represents an invalid type.public PsiCodeBlock createCodeBlock()
PsiElementFactory
createCodeBlock
in interface PsiElementFactory
public PsiClassType createType(PsiClass aClass)
JVMElementFactory
createType
in interface JVMElementFactory
public PsiClassType createType(PsiJavaCodeReferenceElement classReference)
PsiElementFactory
createType
in interface PsiElementFactory
public PsiClassType createType(PsiClass aClass, PsiType parameter)
createType
in interface JVMElementFactory
createType
in interface PsiElementFactory
public PsiClassType createType(PsiClass aClass, PsiType... parameters)
createType
in interface JVMElementFactory
createType
in interface PsiElementFactory
public PsiSubstitutor createRawSubstitutor(PsiTypeParameterListOwner owner)
PsiElementFactory
createRawSubstitutor
in interface JVMElementFactory
createRawSubstitutor
in interface PsiElementFactory
public PsiSubstitutor createRawSubstitutor(PsiSubstitutor baseSubstitutor, PsiTypeParameter [] typeParameters)
createRawSubstitutor
in interface PsiElementFactory
public PsiElement createDummyHolder(java.lang.String text, IElementType type, PsiElement context)
PsiElementFactory
PsiParser.parse(IElementType, com.intellij.lang.PsiBuilder)
.createDummyHolder
in interface PsiElementFactory
text
- text to parsetype
- node typecontext
- contextpublic PsiSubstitutor createSubstitutor(java.util.Map<PsiTypeParameter,PsiType> map)
PsiElementFactory
createSubstitutor
in interface JVMElementFactory
createSubstitutor
in interface PsiElementFactory
public PsiPrimitiveType createPrimitiveType(java.lang.String text)
PsiElementFactory
createPrimitiveType
in interface JVMElementFactory
createPrimitiveType
in interface PsiElementFactory
text
- the name of a Java primitive type (for example, int
)null
if name
is not a valid
primitive type name.public PsiClassType createTypeByFQClassName(java.lang.String qName)
PsiElementFactory
PsiElementFactory.createTypeByFQClassName(String, GlobalSearchScope)
with GlobalSearchScope.allScope(Project)
.createTypeByFQClassName
in interface JVMElementFactory
createTypeByFQClassName
in interface PsiElementFactory
public PsiClassType createTypeByFQClassName(java.lang.String qName, GlobalSearchScope resolveScope)
PsiElementFactory
createTypeByFQClassName
in interface JVMElementFactory
createTypeByFQClassName
in interface PsiElementFactory
public PsiJavaCodeReferenceElement createClassReferenceElement(PsiClass aClass)
PsiElementFactory
createClassReferenceElement
in interface PsiElementFactory
public PsiJavaCodeReferenceElement createReferenceElementByFQClassName(java.lang.String qName, GlobalSearchScope resolveScope)
PsiElementFactory
createReferenceElementByFQClassName
in interface PsiElementFactory
public PsiJavaCodeReferenceElement createFQClassNameReferenceElement(java.lang.String qName, GlobalSearchScope resolveScope)
PsiElementFactory
createFQClassNameReferenceElement
in interface PsiElementFactory
public PsiJavaCodeReferenceElement createPackageReferenceElement(PsiPackage aPackage) throws IncorrectOperationException
PsiElementFactory
createPackageReferenceElement
in interface PsiElementFactory
IncorrectOperationException
- if aPackage
is the default (root) package.public PsiPackageStatement createPackageStatement(java.lang.String name) throws IncorrectOperationException
PsiElementFactory
createPackageStatement
in interface PsiElementFactory
IncorrectOperationException
- if name
is not a valid package name.public PsiImportStaticStatement createImportStaticStatement(PsiClass aClass, java.lang.String memberName) throws IncorrectOperationException
PsiElementFactory
import static
statement for importing the specified member
from the specified class.createImportStaticStatement
in interface PsiElementFactory
IncorrectOperationException
- if the class is inner or local, or
memberName
is not a valid identifier.public PsiParameterList createParameterList(java.lang.String [] names, PsiType [] types) throws IncorrectOperationException
PsiElementFactory
createParameterList
in interface JVMElementFactory
createParameterList
in interface PsiElementFactory
IncorrectOperationException
- if any of the parameter names or types are invalid.public PsiReferenceList createReferenceList(PsiJavaCodeReferenceElement [] references) throws IncorrectOperationException
PsiElementFactory
createReferenceList
in interface PsiElementFactory
IncorrectOperationException
- if some of the references are invalid.public PsiJavaCodeReferenceElement createPackageReferenceElement(java.lang.String packageName) throws IncorrectOperationException
PsiElementFactory
createPackageReferenceElement
in interface PsiElementFactory
IncorrectOperationException
- if packageName
is an empty string.public PsiReferenceExpression createReferenceExpression(PsiClass aClass) throws IncorrectOperationException
PsiElementFactory
createReferenceExpression
in interface PsiElementFactory
IncorrectOperationException
- never (the exception is kept for compatibility purposes).public PsiReferenceExpression createReferenceExpression(PsiPackage aPackage) throws IncorrectOperationException
PsiElementFactory
createReferenceExpression
in interface PsiElementFactory
IncorrectOperationException
- if aPackage
is the default (root) package.public PsiIdentifier createIdentifier(java.lang.String text) throws IncorrectOperationException
PsiElementFactory
createIdentifier
in interface PsiElementFactory
IncorrectOperationException
- if text
is not a valid Java identifier.public PsiKeyword createKeyword(java.lang.String text) throws IncorrectOperationException
PsiElementFactory
createKeyword
in interface PsiElementFactory
IncorrectOperationException
- if text
is not a valid Java keyword.public PsiKeyword createKeyword(java.lang.String keyword, PsiElement context) throws IncorrectOperationException
createKeyword
in interface PsiElementFactory
IncorrectOperationException
public PsiImportStatement createImportStatement(PsiClass aClass) throws IncorrectOperationException
PsiElementFactory
createImportStatement
in interface PsiElementFactory
IncorrectOperationException
- if aClass
is an anonymous or local class.public PsiImportStatement createImportStatementOnDemand(java.lang.String packageName) throws IncorrectOperationException
PsiElementFactory
createImportStatementOnDemand
in interface PsiElementFactory
IncorrectOperationException
- if packageName
is not a valid qualified package name.public PsiDeclarationStatement createVariableDeclarationStatement(java.lang.String name, PsiType type, PsiExpression initializer) throws IncorrectOperationException
PsiElementFactory
Note that depending on code style settings the resulting variable may be declared as final
.
createVariableDeclarationStatement
in interface PsiElementFactory
IncorrectOperationException
- if name
is not a valid identifier or
type
is not a valid type.public PsiDeclarationStatement createVariableDeclarationStatement(java.lang.String name, PsiType type, PsiExpression initializer, PsiElement context) throws IncorrectOperationException
PsiElementFactory
Note that depending on code style settings the resulting variable may be declared as final
.
createVariableDeclarationStatement
in interface PsiElementFactory
context
- the context used to resolve symbols in the resulting declaration.IncorrectOperationException
- if name
is not a valid identifier or
type
is not a valid type.public PsiResourceVariable createResourceVariable(java.lang.String name, PsiType type, PsiExpression initializer, PsiElement context)
PsiElementFactory
createResourceVariable
in interface PsiElementFactory
context
- the context for dummy holderpublic PsiDocTag createParamTag(java.lang.String parameterName, java.lang.String description) throws IncorrectOperationException
PsiElementFactory
createParamTag
in interface PsiElementFactory
IncorrectOperationException
- if the name or description are invalid.public PsiAnnotation createAnnotationFromText(java.lang.String annotationText, PsiElement context) throws IncorrectOperationException
PsiJavaParserFacade
createAnnotationFromText
in interface JVMElementFactory
createAnnotationFromText
in interface PsiJavaParserFacade
createAnnotationFromText
in class PsiJavaParserFacadeImpl
annotationText
- the text of the annotation to create.context
- the context for resolving references from the annotation.IncorrectOperationException
- if the text does not specify a valid annotation.public PsiAnnotation createAnnotationFromText(java.lang.String annotationText, PsiElement context, boolean markGenerated) throws IncorrectOperationException
IncorrectOperationException
public PsiCodeBlock createCodeBlockFromText(java.lang.String text, PsiElement context) throws IncorrectOperationException
PsiJavaParserFacade
createCodeBlockFromText
in interface PsiJavaParserFacade
createCodeBlockFromText
in class PsiJavaParserFacadeImpl
text
- the text of the code block to create.context
- the PSI element used as context for resolving references from the block.IncorrectOperationException
- if the text does not specify a valid code block.public PsiEnumConstant createEnumConstantFromText(java.lang.String text, PsiElement context) throws IncorrectOperationException
createEnumConstantFromText
in interface PsiJavaParserFacade
createEnumConstantFromText
in class PsiJavaParserFacadeImpl
IncorrectOperationException
public PsiExpression createExpressionFromText(java.lang.String text, PsiElement context) throws IncorrectOperationException
PsiJavaParserFacade
createExpressionFromText
in interface JVMElementFactory
createExpressionFromText
in interface PsiElementFactory
createExpressionFromText
in interface PsiJavaParserFacade
createExpressionFromText
in class PsiJavaParserFacadeImpl
text
- the text of the expression to create.context
- the PSI element used as context for resolving references from the expression.IncorrectOperationException
- if the text does not specify a valid expression.public PsiField createFieldFromText(java.lang.String text, PsiElement context) throws IncorrectOperationException
PsiJavaParserFacade
createFieldFromText
in interface PsiJavaParserFacade
createFieldFromText
in class PsiJavaParserFacadeImpl
text
- the text of the field to create.context
- the PSI element used as context for resolving references from the field.IncorrectOperationException
- if the text is not a valid field body.public PsiParameter createParameterFromText(java.lang.String text, PsiElement context) throws IncorrectOperationException
PsiJavaParserFacade
createParameterFromText
in interface PsiJavaParserFacade
createParameterFromText
in class PsiJavaParserFacadeImpl
text
- the text of the parameter to create.context
- the PSI element used as context for resolving references from the parameter.IncorrectOperationException
- if the text is not a valid parameter body.public PsiStatement createStatementFromText(java.lang.String text, PsiElement context) throws IncorrectOperationException
PsiJavaParserFacade
createStatementFromText
in interface PsiJavaParserFacade
createStatementFromText
in class PsiJavaParserFacadeImpl
text
- the text of the statement to create.context
- the PSI element used as context for resolving references from the statement.IncorrectOperationException
- if the text does not specify a valid statement.public PsiType createTypeFromText(java.lang.String text, PsiElement context) throws IncorrectOperationException
PsiJavaParserFacade
createTypeFromText
in interface PsiJavaParserFacade
createTypeFromText
in class PsiJavaParserFacadeImpl
text
- the text of the type to create (for example, a primitive type keyword, an array
declaration or the name of a class).context
- the PSI element used as context for resolving the reference.IncorrectOperationException
- if the text does not specify a valid type.public PsiTypeParameter createTypeParameterFromText(java.lang.String text, PsiElement context) throws IncorrectOperationException
PsiJavaParserFacade
createTypeParameterFromText
in interface PsiJavaParserFacade
createTypeParameterFromText
in class PsiJavaParserFacadeImpl
text
- the text of the type parameter to create.context
- the context for resolving references.IncorrectOperationException
- if the text does not specify a valid type parameter.public PsiMethod createMethodFromText(java.lang.String text, PsiElement context, LanguageLevel level) throws IncorrectOperationException
PsiJavaParserFacade
createMethodFromText
in interface PsiJavaParserFacade
createMethodFromText
in class PsiJavaParserFacadeImpl
text
- the text of the method to create.context
- the PSI element used as context for resolving references from the method.level
- the language level used for creating the method.IncorrectOperationException
- if the text is not a valid method body.public PsiCatchSection createCatchSection(PsiType exceptionType, java.lang.String exceptionName, PsiElement context) throws IncorrectOperationException
PsiElementFactory
catch
section for catching an exception of the specified
type and name.createCatchSection
in interface PsiElementFactory
exceptionType
- the type of the exception to catch (either PsiClassType or PsiDisjunctionType).exceptionName
- the name of the variable in which the caught exception is stored (may be an empty string).context
- the context for resolving references.IncorrectOperationException
- if any of the parameters are not valid.public boolean isValidClassName(java.lang.String name)
JVMElementFactory
isValidClassName
in interface JVMElementFactory
public boolean isValidMethodName(java.lang.String name)
JVMElementFactory
isValidMethodName
in interface JVMElementFactory
public boolean isValidParameterName(java.lang.String name)
JVMElementFactory
isValidParameterName
in interface JVMElementFactory
public boolean isValidFieldName(java.lang.String name)
JVMElementFactory
isValidFieldName
in interface JVMElementFactory
public boolean isValidLocalVariableName(java.lang.String name)
JVMElementFactory
isValidLocalVariableName
in interface JVMElementFactory