MCPcopy Index your code
hub / github.com/apache/groovy / getImport

Method getImport

src/main/java/org/codehaus/groovy/ast/ModuleNode.java:198–202  ·  view source on GitHub ↗

Looks up an import node by its alias name. Searches regular imports and returns the matching node. Caches import alias mappings as node metadata for performance. @param alias the imported name to look up @return the ImportNode for that import, or null if not found

(final String alias)

Source from the content-addressed store, hash-verified

196 * @return the {@link ImportNode} for that import, or null if not found
197 */
198 public ImportNode getImport(final String alias) {
199 Map<String, ImportNode> aliases = getNodeMetaData("import.aliases", x ->
200 imports.stream().collect(Collectors.toMap(ImportNode::getAlias, n -> n, (n, m) -> m)));
201 return aliases.get(alias);
202 }
203
204 /**
205 * Registers a regular import (e.g., {@code import java.util.List}).

Callers 3

testDuplicateImportsMethod · 0.95
getImportTypeMethod · 0.95

Calls 5

getNodeMetaDataMethod · 0.65
streamMethod · 0.65
getMethod · 0.65
collectMethod · 0.45
toMapMethod · 0.45

Tested by 1

testDuplicateImportsMethod · 0.76