Class ImportDeclarationHelpers
java.lang.Object
eu.solven.cleanthat.engine.java.refactorer.helpers.ImportDeclarationHelpers
Helps working with
ImportDeclaration
- Author:
- Benoit Lacelle
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static String
getSimpleName
(String qualifiedName) static String
getStaticMethodClassRefMayAddImport
(NodeAndSymbolSolver<?> node, Class<?> clazz) static boolean
isImportable
(NodeAndSymbolSolver<?> context, String qualifiedName) static boolean
isImported
(NodeAndSymbolSolver<?> compilationUnit, String methodRefPackage, String qualifiedName) static boolean
isImported
(NodeAndSymbolSolver<? extends com.github.javaparser.ast.expr.Expression> context, com.github.javaparser.ast.ImportDeclaration importDeclaration) static boolean
isImported
(NodeAndSymbolSolver<? extends com.github.javaparser.ast.expr.Expression> expr, String imported) static com.github.javaparser.ast.expr.NameExpr
nameOrQualifiedName
(NodeAndSymbolSolver<?> compilationUnit, Class<?> clazz)
-
Constructor Details
-
ImportDeclarationHelpers
protected ImportDeclarationHelpers()
-
-
Method Details
-
isImported
public static boolean isImported(NodeAndSymbolSolver<?> compilationUnit, String methodRefPackage, String qualifiedName) - Parameters:
compilationUnit
-methodRefPackage
-qualifiedName
-- Returns:
- true if the given qualifiedName (which may be a nested Class) in given package is already imported in given CompilationUnit
-
getStaticMethodClassRefMayAddImport
public static String getStaticMethodClassRefMayAddImport(NodeAndSymbolSolver<?> node, Class<?> clazz) -
getSimpleName
-
isImportable
- Parameters:
context
-qualifiedName
-- Returns:
- true if the given qualifiedName (which may be a nested Class) in given package can be imported in given CompilationUnit without conflicting existing imports
-
nameOrQualifiedName
public static com.github.javaparser.ast.expr.NameExpr nameOrQualifiedName(NodeAndSymbolSolver<?> compilationUnit, Class<?> clazz) -
isImported
public static boolean isImported(NodeAndSymbolSolver<? extends com.github.javaparser.ast.expr.Expression> expr, String imported) -
isImported
public static boolean isImported(NodeAndSymbolSolver<? extends com.github.javaparser.ast.expr.Expression> context, com.github.javaparser.ast.ImportDeclaration importDeclaration)
-