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:
DynamicTypeLoader,PackageTypeLoader,PropertiesTypeLoader,SimpleTypeLoader,TypeInPackageTypeLoader
public abstract class TypeLoaderBase extends BaseService implements ITypeLoader
-
-
Field Summary
Fields Modifier and Type Field Description protected IModule_moduleprotected java.util.Set<java.lang.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()java.util.Set<java.lang.String>getAllTypeNames()private java.lang.StringgetId()IModulegetModule()java.lang.StringgetNamespaceForDirectory(IDirectory dir)java.net.URLgetResource(java.lang.String name)Finds the resource with the given name.java.util.Set<TypeName>getTypeNames(java.lang.String namespace)static java.util.Set<TypeName>getTypeNames(java.lang.String parentNamespace, ITypeLoader loader)java.lang.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()java.util.Set<java.lang.String>loadTypeNames()voidrefreshed()Fired when the typesystem is fully refreshedRefreshKindrefreshedFile(IFile file, java.lang.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()java.lang.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
-
-
-
-
Field Detail
-
_module
protected IModule _module
-
_typeNames
protected java.util.Set<java.lang.String> _typeNames
-
-
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 java.lang.String getNamespaceForDirectory(IDirectory dir)
- Specified by:
getNamespaceForDirectoryin interfaceITypeLoader
-
getTypesForFile
public java.lang.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, java.lang.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 java.net.URL getResource(java.lang.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()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getTypeNames
public java.util.Set<TypeName> getTypeNames(java.lang.String namespace)
- Specified by:
getTypeNamesin interfaceITypeLoader
-
getTypeNames
public static java.util.Set<TypeName> getTypeNames(java.lang.String parentNamespace, ITypeLoader loader)
-
showTypeNamesInIDE
public boolean showTypeNamesInIDE()
- Specified by:
showTypeNamesInIDEin interfaceITypeLoader
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfaceITypeLoader
-
getId
private java.lang.String getId()
-
deleteIndexFile
protected void deleteIndexFile()
-
saveTypeNames
public void saveTypeNames()
-
loadTypeNames
public java.util.Set<java.lang.String> loadTypeNames()
-
getAllTypeNames
public final java.util.Set<java.lang.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()
-
-