com.intellij.psi
Class PsiNameHelper

java.lang.Object
  extended by com.intellij.psi.PsiNameHelper

public abstract class PsiNameHelper
extends java.lang.Object

Service for validating and parsing Java identifiers.

See Also:
PsiManager.getNameHelper()

Constructor Summary
PsiNameHelper()
           
 
Method Summary
static java.lang.String[] getClassParametersText(java.lang.String referenceText)
          Obtains text of all type parameter values in a reference.
static java.lang.String getPresentableText(PsiJavaCodeReferenceElement ref)
           
static java.lang.String getQualifiedClassName(java.lang.String referenceText, boolean removeWhitespace)
           
static java.lang.String getShortClassName(java.lang.String referenceText)
           
abstract  boolean isIdentifier(java.lang.String text)
          Checks if the specified text is a Java identifier, using the language level of the project with which the name helper is associated to filter out keywords.
abstract  boolean isIdentifier(java.lang.String text, LanguageLevel languageLevel)
          Checks if the specified text is a Java identifier, using the specified language level with which the name helper is associated to filter out keywords.
abstract  boolean isKeyword(java.lang.String text)
          Checks if the specified text is a Java keyword, using the language level of the project with which the name helper is associated.
abstract  boolean isQualifiedName(java.lang.String text)
          Checks if the specified string is a qualified name (sequence of identifiers separated by periods).
static java.lang.String[] splitNameIntoWords(java.lang.String name)
          Splits an identifier into words, separated with underscores or upper-case characters (camel-case).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PsiNameHelper

public PsiNameHelper()
Method Detail

isIdentifier

public abstract boolean isIdentifier(java.lang.String text)
Checks if the specified text is a Java identifier, using the language level of the project with which the name helper is associated to filter out keywords.

Parameters:
text - the text to check.
Returns:
true if the text is an identifier, false otherwise

isIdentifier

public abstract boolean isIdentifier(java.lang.String text,
                                     LanguageLevel languageLevel)
Checks if the specified text is a Java identifier, using the specified language level with which the name helper is associated to filter out keywords.

Parameters:
text - the text to check.
Returns:
true if the text is an identifier, false otherwise

isKeyword

public abstract boolean isKeyword(java.lang.String text)
Checks if the specified text is a Java keyword, using the language level of the project with which the name helper is associated.

Parameters:
text - the text to check.
Returns:
true if the text is a keyword, false otherwise

isQualifiedName

public abstract boolean isQualifiedName(java.lang.String text)
Checks if the specified string is a qualified name (sequence of identifiers separated by periods).

Parameters:
text - the text to check.
Returns:
true if the text is a qualified name, false otherwise.

getShortClassName

public static java.lang.String getShortClassName(java.lang.String referenceText)

getPresentableText

public static java.lang.String getPresentableText(PsiJavaCodeReferenceElement ref)

getQualifiedClassName

public static java.lang.String getQualifiedClassName(java.lang.String referenceText,
                                                     boolean removeWhitespace)

getClassParametersText

public static java.lang.String[] getClassParametersText(java.lang.String referenceText)
Obtains text of all type parameter values in a reference. They go in left-to-right order: A<List<String>>.B<Integer> yields ["List<String>","Integer"]

Parameters:
referenceText - the text of the reference to calculate type parameters for.
Returns:
the calculated array of type parameters.

splitNameIntoWords

public static java.lang.String[] splitNameIntoWords(java.lang.String name)
Splits an identifier into words, separated with underscores or upper-case characters (camel-case).

Parameters:
name - the identifier to split.
Returns:
the array of strings into which the identifier has been split.