Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Modifiers | Name | Description |
---|---|---|
static class |
ClassNodeResolver.LookupResult |
Helper class to return either a SourceUnit or ClassNode. |
Type | Name and description |
---|---|
void |
cacheClass(String name, ClassNode res) caches a ClassNode |
ClassNodeResolver.LookupResult |
findClassNode(String name, CompilationUnit compilationUnit) Extension point for custom lookup logic of finding ClassNodes. |
ClassNode |
getFromClassCache(String name) returns whatever is stored in the class cache for the given name |
ClassNodeResolver.LookupResult |
resolveName(String name, CompilationUnit compilationUnit) Resolves the name of a class to a SourceUnit or ClassNode. |
Internal helper used to indicate a cache hit for a class that does not exist. This way further lookups through a slow findClassNode(String, CompilationUnit) path can be avoided. WARNING: This class is not to be used outside of ClassNodeResolver.
caches a ClassNode
name
- - the name of the classres
- - the ClassNode for that nameExtension point for custom lookup logic of finding ClassNodes. Per default this will use the CompilationUnit class loader to do a lookup on the class path and load the needed class using that loader. Or if a script is found and that script is seen as "newer", the script will be used instead of the class.
name
- - the name of the classcompilationUnit
- - the current compilation unitreturns whatever is stored in the class cache for the given name
name
- - the name of the classResolves the name of a class to a SourceUnit or ClassNode. If no class or source is found this method returns null. A lookup is done by first asking the cache if there is an entry for the class already available to then call findClassNode(String, CompilationUnit). The result of that method call will be cached if a ClassNode is found. If a SourceUnit is found, this method will not be asked later on again for that class, because ResolveVisitor will first ask the CompilationUnit for classes in the compilation queue and it will find the class for that SourceUnit there then. method return a ClassNode instead of a SourceUnit, the res
name
- - the name of the classcompilationUnit
- - the current CompilationUnit