Package gw.lang.reflect
Class TypeLoaderBase
- java.lang.Object
-
- gw.config.BaseService
-
- gw.lang.reflect.TypeLoaderBase
-
- All Implemented Interfaces:
IService,ITypeLoader,IPluginHost
- Direct Known Subclasses:
SimpleTypeLoader
public abstract class TypeLoaderBase extends BaseService implements ITypeLoader
-
-
Field Summary
Fields Modifier and Type Field Description protected IModule_moduleprotected Set<String>_typeNames-
Fields inherited from interface gw.lang.reflect.ITypeLoader
NO_TYPES
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedTypeLoaderBase()Deprecated.use TypeLoaderBase( IModule )protectedTypeLoaderBase(IModule module)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidclearTypeNames()protected voiddeleteIndexFile()Set<String>getAllTypeNames()IModulegetModule()StringgetNamespaceForDirectory(IDirectory dir)URLgetResource(String name)Finds the resource with the given name.Set<TypeName>getTypeNames(String namespace)static Set<TypeName>getTypeNames(String parentNamespace, ITypeLoader loader)String[]getTypesForFile(IFile file)Returns ALL type names associated with the given file whether or not the types have been loaded yet.booleanhandlesDirectory(IDirectory dir)booleanhandlesFile(IFile file)booleanisCaseSensitive()Set<String>loadTypeNames()voidrefreshed()Fired when the typesystem is fully refreshedRefreshKindrefreshedFile(IFile file, String[] types, RefreshKind kind)Notifies the type loader that a file has been refreshed.protected voidrefreshedImpl()voidrefreshedTypes(RefreshRequest request)Fired when an existing type is refreshed, i.e.protected voidrefreshedTypesImpl(RefreshRequest request)voidsaveTypeNames()protected booleanshouldCacheTypeNames()booleanshowTypeNamesInIDE()voidshutdown()StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface gw.plugin.IPluginHost
getInterface
-
Methods inherited from interface gw.lang.reflect.ITypeLoader
computeTypeNames, getAllNamespaces, getHandledPrefixes, getType, handlesNonPrefixLoads, hasNamespace, refreshedNamespace
-
-
-
-
Constructor Detail
-
TypeLoaderBase
protected TypeLoaderBase()
Deprecated.use TypeLoaderBase( IModule )
-
TypeLoaderBase
protected TypeLoaderBase(IModule module)
-
-
Method Detail
-
getModule
public IModule getModule()
- Specified by:
getModulein interfaceITypeLoader- Returns:
- The module to which this type loader belongs.
-
isCaseSensitive
public boolean isCaseSensitive()
- Specified by:
isCaseSensitivein interfaceITypeLoader
-
handlesFile
public boolean handlesFile(IFile file)
- Specified by:
handlesFilein interfaceITypeLoader
-
handlesDirectory
public boolean handlesDirectory(IDirectory dir)
- Specified by:
handlesDirectoryin interfaceITypeLoader
-
getNamespaceForDirectory
public String getNamespaceForDirectory(IDirectory dir)
- Specified by:
getNamespaceForDirectoryin interfaceITypeLoader
-
getTypesForFile
public String[] getTypesForFile(IFile file)
Description copied from interface:ITypeLoaderReturns ALL type names associated with the given file whether or not the types have been loaded yet. Type loading should NOT be used in the implementation of this method.- Specified by:
getTypesForFilein interfaceITypeLoader- Parameters:
file- The file in question- Returns:
- All known types derived from that file
-
refreshedFile
public RefreshKind refreshedFile(IFile file, String[] types, RefreshKind kind)
Description copied from interface:ITypeLoaderNotifies the type loader that a file has been refreshed. The type loader should return all types that it knows need to be refreshed based on the given file.- Specified by:
refreshedFilein interfaceITypeLoader- Parameters:
file- The file that was refreshed- Returns:
- All known types affected by the file change
-
getResource
public URL getResource(String name)
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- 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.
-
refreshedTypes
public final void refreshedTypes(RefreshRequest request)
Description copied from interface:ITypeLoaderFired when an existing type is refreshed, i.e. there are potential changes- Specified by:
refreshedTypesin interfaceITypeLoader
-
refreshedTypesImpl
protected void refreshedTypesImpl(RefreshRequest request)
-
refreshed
public final void refreshed()
Description copied from interface:ITypeLoaderFired when the typesystem is fully refreshed- Specified by:
refreshedin interfaceITypeLoader
-
clearTypeNames
protected void clearTypeNames()
-
refreshedImpl
protected void refreshedImpl()
-
getTypeNames
public Set<TypeName> getTypeNames(String namespace)
- Specified by:
getTypeNamesin interfaceITypeLoader
-
getTypeNames
public static Set<TypeName> getTypeNames(String parentNamespace, ITypeLoader loader)
-
showTypeNamesInIDE
public boolean showTypeNamesInIDE()
- Specified by:
showTypeNamesInIDEin interfaceITypeLoader
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfaceITypeLoader
-
deleteIndexFile
protected void deleteIndexFile()
-
saveTypeNames
public void saveTypeNames()
-
getAllTypeNames
public final Set<String> getAllTypeNames()
- Specified by:
getAllTypeNamesin interfaceITypeLoader- Returns:
- the set of fully qualified type names this loader is responsible for loading. Note due to the dynamic nature of some type loaders, there is no guarantee that all types for a given loader are known at the time this method is called.
-
shouldCacheTypeNames
protected boolean shouldCacheTypeNames()
-
-