Class DOMASTUtil
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.dom.util.DOMASTUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckASTLevel(int level) static StringgetCompliance(int astLevel) Calculates the JavaCore Option value string corresponding to the input ast level.static booleanisEitherOrMultiPatternSupported(int apiLevel, boolean previewEnabled) static booleanstatic booleanisFeatureSupportedinAST(int apiLevel, boolean previewEnabled, int featureName) Validates if the givenapiLevelandpreviewEnabledsupports the providednodeType.static booleanisFeatureSupportedinAST(int apiLevel, int featureName) Validates if the givenapiLevelandpreviewEnabledsupports the providednodeType.static booleanisFeatureSupportedinAST(AST ast, int featureName) Validates if the givenapiLevelandpreviewEnabledsupports the providednodeType.static booleanisJavaDocCodeSnippetSupported(int apiLevel) static booleanstatic booleanisPatternSupported(int apiLevel, boolean previewEnabled) static booleanisPatternSupported(AST ast) static booleanisPreviewEnabled(int apiLevel, boolean previewEnabled) static booleanisRecordDeclarationSupported(int apiLevel) static booleanstatic booleanstatic booleanisTextBlockSupported(AST ast) static boolean
-
Constructor Details
-
DOMASTUtil
public DOMASTUtil()
-
-
Method Details
-
isFeatureSupportedinAST
Validates if the givenapiLevelandpreviewEnabledsupports the providednodeType. This API checks for node types supported from JLS 14 onwards and will returntruefor nodes added before JLS14.- Parameters:
ast- the AST to be evaluatedfeatureName- the feature name constant indicating the feature to be evaluated- Returns:
trueif the givenASTsupports the providednodeTypeelsefalse- Since:
- 3.22
- See Also:
-
isFeatureSupportedinAST
public static boolean isFeatureSupportedinAST(int apiLevel, boolean previewEnabled, int featureName) Validates if the givenapiLevelandpreviewEnabledsupports the providednodeType. This API checks for node types supported from JLS 14 onwards and will returntruefor 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:
trueif the givenASTsupports the providednodeTypeelsefalse- Since:
- 3.22
- See Also:
-
isFeatureSupportedinAST
public static boolean isFeatureSupportedinAST(int apiLevel, int featureName) Validates if the givenapiLevelandpreviewEnabledsupports the providednodeType. This API checks for node types supported from JLS 14 onwards and will returntruefor nodes added before JLS14.- Parameters:
apiLevel- the level to be checkedfeatureName- the feature name constant indicating the feature to be evaluated- Returns:
trueif the givenASTsupports the providednodeTypeelsefalse- Since:
- 3.27
- See Also:
-
isPreviewEnabled
public static boolean isPreviewEnabled(int apiLevel, boolean previewEnabled) -
isSwitchExpressionSupported
-
isYieldStatementSupported
-
isTextBlockSupported
-
isRecordDeclarationSupported
-
isRecordDeclarationSupported
public static boolean isRecordDeclarationSupported(int apiLevel) -
isPatternInstanceofExpressionSupported
-
isPatternSupported
-
isEitherOrMultiPatternSupported
-
isPatternSupported
public static boolean isPatternSupported(int apiLevel, boolean previewEnabled) -
isEitherOrMultiPatternSupported
public static boolean isEitherOrMultiPatternSupported(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- Returns:
- JavaCore Option value string corresponding to the ast level
-