|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.wst.jsdt.core.JavaScriptConventions
public final class JavaScriptConventions
Provides methods for checking JavaScript-specific conventions such as name syntax.
This class provides static methods and constants only; it is not intended to be instantiated or subclassed by clients.
Provisional API: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.
Method Summary | |
---|---|
static IStatus |
validateClassFileName(java.lang.String name,
java.lang.String sourceLevel,
java.lang.String complianceLevel)
|
static IJavaScriptModelStatus |
validateClasspath(IJavaScriptProject javaProject,
IIncludePathEntry[] rawClasspath,
IPath projectOutputLocation)
Validate a given includepath and output location for a project, using the following rules: Includepath entries cannot collide with each other; that is, all entry paths must be unique. |
static IJavaScriptModelStatus |
validateClasspathEntry(IJavaScriptProject project,
IIncludePathEntry entry,
boolean checkSourceAttachment)
Returns a JavaScript model status describing the problem related to this includepath entry if any, a status object with code IStatus.OK if the entry is fine (that is, if the
given includepath entry denotes a valid element to be referenced onto a includepath). |
static IStatus |
validateCompilationUnitName(java.lang.String name)
Deprecated. Use validateCompilationUnitName(String id, String sourceLevel, String complianceLevel) instead |
static IStatus |
validateCompilationUnitName(java.lang.String name,
java.lang.String sourceLevel,
java.lang.String complianceLevel)
Validate the given javaScript unit name for the given source and compliance levels. |
static IStatus |
validateFieldName(java.lang.String name)
Deprecated. Use validateFieldName(String id, String sourceLevel, String complianceLevel) instead |
static IStatus |
validateFieldName(java.lang.String name,
java.lang.String sourceLevel,
java.lang.String complianceLevel)
Validate the given var or field name for the given source and compliance levels. |
static IStatus |
validateFunctionName(java.lang.String name)
Deprecated. Use validateFunctionName(String id, String sourceLevel, String complianceLevel) instead |
static IStatus |
validateFunctionName(java.lang.String name,
java.lang.String sourceLevel,
java.lang.String complianceLevel)
Validate the given function name for the given source and compliance levels. |
static IStatus |
validateIdentifier(java.lang.String id)
Deprecated. Use validateIdentifier(String id, String sourceLevel, String complianceLevel) instead |
static IStatus |
validateIdentifier(java.lang.String id,
java.lang.String sourceLevel,
java.lang.String complianceLevel)
Validate the given JavaScript identifier for the given source and compliance levels The identifier must not have the same spelling as a JavaScript keyword, boolean literal ( "true" , "false" ), or null literal ("null" ). |
static IStatus |
validateImportDeclaration(java.lang.String name,
java.lang.String sourceLevel,
java.lang.String complianceLevel)
Validate the given import declaration name for the given source and compliance levels. |
static IStatus |
validateJavaScriptTypeName(java.lang.String name)
Deprecated. Use validateJavaScriptTypeName(String id, String sourceLevel, String complianceLevel) instead |
static IStatus |
validateJavaScriptTypeName(java.lang.String name,
java.lang.String sourceLevel,
java.lang.String complianceLevel)
Validate the given JavaScript type name, either simple or qualified, for the given source and compliance levels. |
static IStatus |
validatePackageName(java.lang.String name)
Deprecated. Use validatePackageName(String id, String sourceLevel, String complianceLevel) instead |
static IStatus |
validatePackageName(java.lang.String name,
java.lang.String sourceLevel,
java.lang.String complianceLevel)
Validate the given package name for the given source and compliance levels. |
static IStatus |
validateTypeVariableName(java.lang.String name)
Deprecated. Use validateTypeVariableName(String id, String sourceLevel, String complianceLevel) instead |
static IStatus |
validateTypeVariableName(java.lang.String name,
java.lang.String sourceLevel,
java.lang.String complianceLevel)
Validate the given type variable name for the given source and compliance levels. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static IStatus validateCompilationUnitName(java.lang.String name)
validateCompilationUnitName(String id, String sourceLevel, String complianceLevel)
instead
A javaScript unit name must obey the following rules:
JavaScript-like extensions
name
- the name of a javaScript unit
IStatus.OK
if
the given name is valid as a javaScript unit name, otherwise a status
object indicating what is wrong with the namepublic static IStatus validateCompilationUnitName(java.lang.String name, java.lang.String sourceLevel, java.lang.String complianceLevel)
A javaScript unit name must obey the following rules:
JavaScript-like extensions
name
- the name of a javaScript unitsourceLevel
- the source levelcomplianceLevel
- the compliance level
IStatus.OK
if
the given name is valid as a javaScript unit name, otherwise a status
object indicating what is wrong with the namepublic static IStatus validateClassFileName(java.lang.String name, java.lang.String sourceLevel, java.lang.String complianceLevel)
public static IStatus validateFieldName(java.lang.String name)
validateFieldName(String id, String sourceLevel, String complianceLevel)
instead
Syntax of a field name corresponds to VariableDeclaratorId (JLS2 8.3).
For example, "x"
.
name
- the name of a field
IStatus.OK
if
the given name is valid as a field name, otherwise a status
object indicating what is wrong with the namepublic static IStatus validateFieldName(java.lang.String name, java.lang.String sourceLevel, java.lang.String complianceLevel)
Syntax of a field name corresponds to VariableDeclaratorId (JLS2 8.3).
For example, "x"
.
name
- the name of a fieldsourceLevel
- the source levelcomplianceLevel
- the compliance level
IStatus.OK
if
the given name is valid as a field name, otherwise a status
object indicating what is wrong with the namepublic static IStatus validateIdentifier(java.lang.String id)
validateIdentifier(String id, String sourceLevel, String complianceLevel)
instead
"true"
, "false"
), or null literal ("null"
).
A valid identifier can act as a simple type name, method name or field name.
id
- the JavaScript identifier
IStatus.OK
if
the given identifier is a valid JavaScript identifier, otherwise a status
object indicating what is wrong with the identifierpublic static IStatus validateIdentifier(java.lang.String id, java.lang.String sourceLevel, java.lang.String complianceLevel)
"true"
, "false"
), or null literal ("null"
).
A valid identifier can act as a simple type name, method name or field name.
id
- the JavaScript identifiersourceLevel
- the source levelcomplianceLevel
- the compliance level
IStatus.OK
if
the given identifier is a valid JavaScript identifier, otherwise a status
object indicating what is wrong with the identifierpublic static IStatus validateImportDeclaration(java.lang.String name, java.lang.String sourceLevel, java.lang.String complianceLevel)
The name of an import corresponds to a fully qualified type name.
Note: This Method only applies to ECMAScript 4 which is not yet supported
name
- the import declarationsourceLevel
- the source levelcomplianceLevel
- the compliance level
IStatus.OK
if
the given name is valid as an import declaration, otherwise a status
object indicating what is wrong with the namepublic static IStatus validateJavaScriptTypeName(java.lang.String name)
validateJavaScriptTypeName(String id, String sourceLevel, String complianceLevel)
instead
name
- the name of a type
IStatus.OK
if
the given name is valid as a JavaScript type name,
a status with code IStatus.WARNING
indicating why the given name is discouraged,
otherwise a status object indicating what is wrong with
the namepublic static IStatus validateJavaScriptTypeName(java.lang.String name, java.lang.String sourceLevel, java.lang.String complianceLevel)
name
- the name of a typesourceLevel
- the source levelcomplianceLevel
- the compliance level
IStatus.OK
if
the given name is valid as a JavaScript type name,
a status with code IStatus.WARNING
indicating why the given name is discouraged,
otherwise a status object indicating what is wrong with
the namepublic static IStatus validateFunctionName(java.lang.String name)
validateFunctionName(String id, String sourceLevel, String complianceLevel)
instead
name
- the name of a method
IStatus.OK
if
the given name is valid as a method name, otherwise a status
object indicating what is wrong with the namepublic static IStatus validateFunctionName(java.lang.String name, java.lang.String sourceLevel, java.lang.String complianceLevel)
name
- the name of a methodsourceLevel
- the source levelcomplianceLevel
- the compliance level
IStatus.OK
if
the given name is valid as a method name, otherwise a status
object indicating what is wrong with the namepublic static IStatus validatePackageName(java.lang.String name)
validatePackageName(String id, String sourceLevel, String complianceLevel)
instead
The syntax of a package name corresponds to PackageName as defined by PackageDeclaration.
Note that the given name must be a non-empty package name (that is, attempting to validate the default package will return an error status.) Also it must not contain any characters or substrings that are not valid on the file system on which workspace root is located.
Note: This Method only applies to ECMAScript 4 which is not yet supported
name
- the name of a package
IStatus.OK
if
the given name is valid as a package name, otherwise a status
object indicating what is wrong with the namepublic static IStatus validatePackageName(java.lang.String name, java.lang.String sourceLevel, java.lang.String complianceLevel)
The syntax of a package name corresponds to PackageName as defined by PackageDeclaration.
Note that the given name must be a non-empty package name (that is, attempting to validate the default package will return an error status.) Also it must not contain any characters or substrings that are not valid on the file system on which workspace root is located.
Note: This Method only applies to ECMAScript 4 which is not yet supported
name
- the name of a packagesourceLevel
- the source levelcomplianceLevel
- the compliance level
IStatus.OK
if
the given name is valid as a package name, otherwise a status
object indicating what is wrong with the namepublic static IJavaScriptModelStatus validateClasspath(IJavaScriptProject javaProject, IIncludePathEntry[] rawClasspath, IPath projectOutputLocation)
This validation is intended to anticipate includepath issues prior to assigning it to a project. In particular, it will automatically be performed during the includepath setting operation (if validation fails, the includepath setting will not complete).
javaProject
- the given javaScript projectrawClasspath
- the given includepathprojectOutputLocation
- the given output location
IStatus.OK
if
the given includepath and output location are compatible, otherwise a status
object indicating what is wrong with the includepath or output locationpublic static IJavaScriptModelStatus validateClasspathEntry(IJavaScriptProject project, IIncludePathEntry entry, boolean checkSourceAttachment)
IStatus.OK
if the entry is fine (that is, if the
given includepath entry denotes a valid element to be referenced onto a includepath).
project
- the given javaScript projectentry
- the given includepath entrycheckSourceAttachment
- a flag to determine if source attachement should be checked
IStatus.OK
if the entry is finepublic static IStatus validateTypeVariableName(java.lang.String name)
validateTypeVariableName(String id, String sourceLevel, String complianceLevel)
instead
Note: This Method only applies to ECMAScript 4 which is not yet supported
name
- the name of a type variable
IStatus.OK
if
the given name is valid as a type variable name, otherwise a status
object indicating what is wrong with the namepublic static IStatus validateTypeVariableName(java.lang.String name, java.lang.String sourceLevel, java.lang.String complianceLevel)
Note: This Method only applies to ECMAScript 4 which is not yet supported
name
- the name of a type variablesourceLevel
- the source levelcomplianceLevel
- the compliance level
IStatus.OK
if
the given name is valid as a type variable name, otherwise a status
object indicating what is wrong with the name
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |