Class DOMASTUtil
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.dom.util.DOMASTUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkASTLevel(int level)
static String
getCompliance(int astLevel)
Calculates the JavaCore Option value string corresponding to the input ast level.static boolean
isFeatureSupportedinAST(int apiLevel, boolean previewEnabled, int featureName)
Validates if the givenapiLevel
andpreviewEnabled
supports the providednodeType
.static boolean
isFeatureSupportedinAST(int apiLevel, int featureName)
Validates if the givenapiLevel
andpreviewEnabled
supports the providednodeType
.static boolean
isFeatureSupportedinAST(AST ast, int featureName)
Validates if the givenapiLevel
andpreviewEnabled
supports the providednodeType
.static boolean
isJavaDocCodeSnippetSupported(int apiLevel)
static boolean
static boolean
isPatternSupported(int apiLevel, boolean previewEnabled)
static boolean
isPatternSupported(AST ast)
static boolean
isPreviewEnabled(int apiLevel, boolean previewEnabled)
static boolean
isRecordDeclarationSupported(int apiLevel)
static boolean
static boolean
static boolean
isTextBlockSupported(AST ast)
static boolean
isYieldStatementSupported(AST ast)
-
Constructor Details
-
DOMASTUtil
public DOMASTUtil()
-
-
Method Details
-
isFeatureSupportedinAST
Validates if the givenapiLevel
andpreviewEnabled
supports the providednodeType
. This API checks for node types supported from JLS 14 onwards and will returntrue>
for nodes added before JLS14.- Parameters:
ast
- the AST to be evaluatedfeatureName
- the feature name constant indicating the feature to be evaluated- Returns:
true
if the givenAST
supports the providednodeType
elsefalse
- Since:
- 3.22
- See Also:
ASTNode.getNodeType()
-
isFeatureSupportedinAST
public static boolean isFeatureSupportedinAST(int apiLevel, boolean previewEnabled, int featureName)Validates if the givenapiLevel
andpreviewEnabled
supports the providednodeType
. This API checks for node types supported from JLS 14 onwards and will returntrue>
for nodes added before JLS14.- Parameters:
apiLevel
- the level to be checkedpreviewEnabled
- the preview feature to be consideredfeatureName
- the feature name constant indicating the feature to be evaluated- Returns:
true
if the givenAST
supports the providednodeType
elsefalse
- Since:
- 3.22
- See Also:
ASTNode.getNodeType()
-
isFeatureSupportedinAST
public static boolean isFeatureSupportedinAST(int apiLevel, int featureName)Validates if the givenapiLevel
andpreviewEnabled
supports the providednodeType
. This API checks for node types supported from JLS 14 onwards and will returntrue>
for nodes added before JLS14.- Parameters:
apiLevel
- the level to be checkedfeatureName
- the feature name constant indicating the feature to be evaluated- Returns:
true
if the givenAST
supports the providednodeType
elsefalse
- Since:
- 3.27
- See Also:
ASTNode.getNodeType()
-
isPreviewEnabled
public static boolean isPreviewEnabled(int apiLevel, boolean previewEnabled) -
isSwitchExpressionSupported
-
isYieldStatementSupported
-
isTextBlockSupported
-
isRecordDeclarationSupported
-
isRecordDeclarationSupported
public static boolean isRecordDeclarationSupported(int apiLevel) -
isPatternInstanceofExpressionSupported
-
isPatternSupported
-
isPatternSupported
public static boolean isPatternSupported(int apiLevel, boolean previewEnabled) -
isJavaDocCodeSnippetSupported
public static boolean isJavaDocCodeSnippetSupported(int apiLevel) -
checkASTLevel
public static void checkASTLevel(int level) -
getCompliance
Calculates the JavaCore Option value string corresponding to the input ast level. AST Level 4 is used for Java versions 1.4 to 1.7 and is converted to compliance level 7 if input ast level is out of boundary, latest compliance will be returned- Parameters:
astLevel
-- Returns:
- JavaCore Option value string corresponding to the ast level
-