Package gw.internal.gosu.parser
Class DefaultTypeLoader
java.lang.Object
gw.config.BaseService
gw.lang.reflect.TypeLoaderBase
gw.lang.reflect.SimpleTypeLoader
gw.internal.gosu.parser.DefaultTypeLoader
- All Implemented Interfaces:
IService,IDefaultTypeLoader,IExtendedTypeLoader,ITypeLoader,IPluginHost
public class DefaultTypeLoader
extends SimpleTypeLoader
implements IExtendedTypeLoader, IDefaultTypeLoader
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ClassCacheprivate Map<String,IJavaClassInfo> private IGosuClassLoaderFields inherited from class gw.lang.reflect.TypeLoaderBase
_module, _typeNamesFields inherited from interface gw.lang.reflect.IDefaultTypeLoader
DOT_JAVA_EXTENSION, EXTENSIONS, EXTENSIONS_ARRAY, JAVA_EXTENSIONFields inherited from interface gw.lang.reflect.ITypeLoader
NO_TYPES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanclassFileExists(String className) void(package private) voidDon't call this method unless you really know what you're doing.private IJavaClassInfogetByClass(String className, IModule lookupModule, IModule actualModule) getInnerType(String fqn) <T> TgetInterface(Class<T> apiInterface) Provides an implementation of a specified interface.getIntrinsicTypeFromObject(Object object) Returns the intrinsic type for the given Object.getJavaClassInfo(AsmClass aClass, IModule gosuModule) getJavaClassInfo(Class aClass, IModule gosuModule) getJavaClassInfo(String fullyQualifiedName) getJavaClassInfoForClassDirectly(Class clazz, IModule module) getResource(String name) Finds the resource with the given name.getSourceFileHandle(String qualifiedName) Gets a type based on a fully-qualified name.getTypeNames(String namespace) booleanbooleanhasNamespace(String namespace) private booleanstatic DefaultTypeLoaderinstance()static DefaultTypeLoaderbooleanloadAsmClass(String className) voidvoidrefreshedNamespace(String namespace, IDirectory dir, RefreshKind kind) voidrefreshedTypesImpl(RefreshRequest request) Methods inherited from class gw.lang.reflect.SimpleTypeLoader
getNamespaceForDirectory, getTypesForFile, handlesDirectory, handlesFile, refreshedFileMethods inherited from class gw.lang.reflect.TypeLoaderBase
clearTypeNames, deleteIndexFile, getAllTypeNames, getModule, getTypeNames, loadTypeNames, refreshed, refreshedTypes, saveTypeNames, shouldCacheTypeNames, showTypeNamesInIDE, shutdown, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface gw.lang.reflect.IDefaultTypeLoader
getSouceFileHandleMethods inherited from interface gw.lang.reflect.ITypeLoader
getAllTypeNames, getModule, getNamespaceForDirectory, getTypesForFile, handlesDirectory, handlesFile, refreshed, refreshedFile, refreshedTypes, showTypeNamesInIDE, shutdown
-
Field Details
-
_classCache
-
_gosuClassLoader
-
_classInfoCache
-
_namespaces
-
-
Constructor Details
-
DefaultTypeLoader
-
-
Method Details
-
instance
-
instance
-
getType
Description copied from interface:ITypeLoaderGets a type based on a fully-qualified name. This could either be the name of an entity, like "entity.User", the name of a typekey, like "typekey.SystemPermission", or a class name, like "java.lang.String". Names can have [] appended to them to create arrays, and multi-dimensional arrays are supported.
If the type can be successfully resolved by the typeloader, it will be returned, otherwise it will return null. The sole exception to this rule is the top-level TypeLoaderAccess, which will throw aClassNotFoundExceptionif none of its composite typeloaders can load the type.
There is a global lock in TypeLoaderAccess that is acquired when this method is called. Basically one type at a time can be loaded from the system. This method is free to release that lock during this call. This is needed to deal with reentrant type loaders. It is the responsibility of this method to make sure the lock is reacquired before this method returns. Type loader access will guarentee that no duplicate types are put into the type loader.- Specified by:
getTypein interfaceITypeLoader- Parameters:
fullyQualifiedName- the fully qualified name of the type- Returns:
- the corresponding IType or null
-
getInnerType
-
getJavaClassInfo
- Specified by:
getJavaClassInfoin interfaceIDefaultTypeLoader
-
getJavaClassInfoForClassDirectly
- Specified by:
getJavaClassInfoForClassDirectlyin interfaceIDefaultTypeLoader
-
getJavaClassInfo
-
getJavaClassInfo
-
resolveJavaClassInfo
-
getSourceFileHandle
- Specified by:
getSourceFileHandlein interfaceIDefaultTypeLoader
-
getByClass
-
getIntrinsicTypeFromObject
Description copied from interface:IExtendedTypeLoaderReturns the intrinsic type for the given Object.- Specified by:
getIntrinsicTypeFromObjectin interfaceIExtendedTypeLoader- Parameters:
object- the object to get an IType for- Returns:
- the IType for the object
-
computeTypeNames
- Specified by:
computeTypeNamesin interfaceITypeLoader
-
getResource
Description copied from interface:ITypeLoaderFinds the resource with the given name. A resource is some data that can be accessed by class code in a way that may be independent of the location of the code. The exact location of the resource is dependent upon the loader implementationThe name of a resource is a '/'-separated path name that identifies the resource.
- Specified by:
getResourcein interfaceITypeLoader- Overrides:
getResourcein classTypeLoaderBase- Parameters:
name- The resource name- Returns:
- A URL object for reading the resource, or null if the resource could not be found or the invoker doesn't have adequate privileges to get the resource.
-
refreshedTypesImpl
- Overrides:
refreshedTypesImplin classTypeLoaderBase
-
isCaseSensitive
public boolean isCaseSensitive()- Specified by:
isCaseSensitivein interfaceITypeLoader- Overrides:
isCaseSensitivein classTypeLoaderBase
-
getHandledPrefixes
- Specified by:
getHandledPrefixesin interfaceITypeLoader
-
handlesNonPrefixLoads
public boolean handlesNonPrefixLoads()- Specified by:
handlesNonPrefixLoadsin interfaceITypeLoader
-
refreshedImpl
public void refreshedImpl()- Overrides:
refreshedImplin classTypeLoaderBase
-
clearMisses
public void clearMisses() -
loadClass
- Specified by:
loadClassin interfaceIDefaultTypeLoader
-
loadAsmClass
-
classFileExists
-
getGosuClassLoader
- Specified by:
getGosuClassLoaderin interfaceIDefaultTypeLoader
-
dumpGosuClassLoader
void dumpGosuClassLoader() -
haveWeRecreatedTheModuleLoader
private boolean haveWeRecreatedTheModuleLoader() -
getExtensions
- Specified by:
getExtensionsin classSimpleTypeLoader
-
hasNamespace
- Specified by:
hasNamespacein interfaceITypeLoader
-
getAllNamespaces
Description copied from interface:ITypeLoaderDon't call this method unless you really know what you're doing.- Specified by:
getAllNamespacesin interfaceITypeLoader- Returns:
- the set of package (aka namespace) names in which this loader's types reside.
-
refreshedNamespace
- Specified by:
refreshedNamespacein interfaceITypeLoader
-
getTypeNames
- Specified by:
getTypeNamesin interfaceITypeLoader- Overrides:
getTypeNamesin classTypeLoaderBase
-
getInterface
Description copied from interface:IPluginHostProvides an implementation of a specified interface.- Specified by:
getInterfacein interfaceIPluginHost- Returns:
- The implementation of the interface or null if unsupported.
-