Class DefaultTypeLoader

All Implemented Interfaces:
IService, IDefaultTypeLoader, IExtendedTypeLoader, ITypeLoader, IPluginHost

public class DefaultTypeLoader extends SimpleTypeLoader implements IExtendedTypeLoader, IDefaultTypeLoader
  • Field Details

  • Constructor Details

    • DefaultTypeLoader

      public DefaultTypeLoader(IModule module)
  • Method Details

    • instance

      public static DefaultTypeLoader instance(IModule module)
    • instance

      public static DefaultTypeLoader instance()
    • getType

      public IType getType(String fullyQualifiedName)
      Description copied from interface: ITypeLoader
      Gets 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 a ClassNotFoundException if 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:
      getType in interface ITypeLoader
      Parameters:
      fullyQualifiedName - the fully qualified name of the type
      Returns:
      the corresponding IType or null
    • getInnerType

      public IJavaType getInnerType(String fqn)
    • getJavaClassInfo

      public IJavaClassInfo getJavaClassInfo(String fullyQualifiedName)
      Specified by:
      getJavaClassInfo in interface IDefaultTypeLoader
    • getJavaClassInfoForClassDirectly

      public IJavaClassInfo getJavaClassInfoForClassDirectly(Class clazz, IModule module)
      Specified by:
      getJavaClassInfoForClassDirectly in interface IDefaultTypeLoader
    • getJavaClassInfo

      public IJavaClassInfo getJavaClassInfo(Class aClass, IModule gosuModule)
    • getJavaClassInfo

      public IJavaClassInfo getJavaClassInfo(AsmClass aClass, IModule gosuModule)
    • resolveJavaClassInfo

      public IJavaClassInfo resolveJavaClassInfo(String fqn)
    • getSourceFileHandle

      public ISourceFileHandle getSourceFileHandle(String qualifiedName)
      Specified by:
      getSourceFileHandle in interface IDefaultTypeLoader
    • getByClass

      private IJavaClassInfo getByClass(String className, IModule lookupModule, IModule actualModule)
    • getIntrinsicTypeFromObject

      public IType getIntrinsicTypeFromObject(Object object)
      Description copied from interface: IExtendedTypeLoader
      Returns the intrinsic type for the given Object.
      Specified by:
      getIntrinsicTypeFromObject in interface IExtendedTypeLoader
      Parameters:
      object - the object to get an IType for
      Returns:
      the IType for the object
    • computeTypeNames

      public Set<String> computeTypeNames()
      Specified by:
      computeTypeNames in interface ITypeLoader
    • getResource

      public URL getResource(String name)
      Description copied from interface: ITypeLoader
      Finds 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 implementation

      The name of a resource is a '/'-separated path name that identifies the resource.

      Specified by:
      getResource in interface ITypeLoader
      Overrides:
      getResource in class TypeLoaderBase
      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

      public void refreshedTypesImpl(RefreshRequest request)
      Overrides:
      refreshedTypesImpl in class TypeLoaderBase
    • isCaseSensitive

      public boolean isCaseSensitive()
      Specified by:
      isCaseSensitive in interface ITypeLoader
      Overrides:
      isCaseSensitive in class TypeLoaderBase
    • getHandledPrefixes

      public List<String> getHandledPrefixes()
      Specified by:
      getHandledPrefixes in interface ITypeLoader
    • handlesNonPrefixLoads

      public boolean handlesNonPrefixLoads()
      Specified by:
      handlesNonPrefixLoads in interface ITypeLoader
    • refreshedImpl

      public void refreshedImpl()
      Overrides:
      refreshedImpl in class TypeLoaderBase
    • clearMisses

      public void clearMisses()
    • loadClass

      public Class loadClass(String className)
      Specified by:
      loadClass in interface IDefaultTypeLoader
    • loadAsmClass

      public AsmClass loadAsmClass(String className)
    • classFileExists

      public boolean classFileExists(String className)
    • getGosuClassLoader

      public IGosuClassLoader getGosuClassLoader()
      Specified by:
      getGosuClassLoader in interface IDefaultTypeLoader
    • dumpGosuClassLoader

      void dumpGosuClassLoader()
    • haveWeRecreatedTheModuleLoader

      private boolean haveWeRecreatedTheModuleLoader()
    • getExtensions

      public Set<String> getExtensions()
      Specified by:
      getExtensions in class SimpleTypeLoader
    • hasNamespace

      public boolean hasNamespace(String namespace)
      Specified by:
      hasNamespace in interface ITypeLoader
    • getAllNamespaces

      public Set<String> getAllNamespaces()
      Description copied from interface: ITypeLoader
      Don't call this method unless you really know what you're doing.
      Specified by:
      getAllNamespaces in interface ITypeLoader
      Returns:
      the set of package (aka namespace) names in which this loader's types reside.
    • refreshedNamespace

      public void refreshedNamespace(String namespace, IDirectory dir, RefreshKind kind)
      Specified by:
      refreshedNamespace in interface ITypeLoader
    • getTypeNames

      public Set<TypeName> getTypeNames(String namespace)
      Specified by:
      getTypeNames in interface ITypeLoader
      Overrides:
      getTypeNames in class TypeLoaderBase
    • getInterface

      public <T> T getInterface(Class<T> apiInterface)
      Description copied from interface: IPluginHost
      Provides an implementation of a specified interface.
      Specified by:
      getInterface in interface IPluginHost
      Returns:
      The implementation of the interface or null if unsupported.