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
_module
protected Set<String>
_typeNames
-
Fields inherited from interface gw.lang.reflect.ITypeLoader
NO_TYPES
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TypeLoaderBase()
Deprecated.use TypeLoaderBase( IModule )protected
TypeLoaderBase(IModule module)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
clearTypeNames()
protected void
deleteIndexFile()
Set<String>
getAllTypeNames()
IModule
getModule()
String
getNamespaceForDirectory(IDirectory dir)
URL
getResource(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.boolean
handlesDirectory(IDirectory dir)
boolean
handlesFile(IFile file)
boolean
isCaseSensitive()
Set<String>
loadTypeNames()
void
refreshed()
Fired when the typesystem is fully refreshedRefreshKind
refreshedFile(IFile file, String[] types, RefreshKind kind)
Notifies the type loader that a file has been refreshed.protected void
refreshedImpl()
void
refreshedTypes(RefreshRequest request)
Fired when an existing type is refreshed, i.e.protected void
refreshedTypesImpl(RefreshRequest request)
void
saveTypeNames()
protected boolean
shouldCacheTypeNames()
boolean
showTypeNamesInIDE()
void
shutdown()
String
toString()
-
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:
getModule
in interfaceITypeLoader
- Returns:
- The module to which this type loader belongs.
-
isCaseSensitive
public boolean isCaseSensitive()
- Specified by:
isCaseSensitive
in interfaceITypeLoader
-
handlesFile
public boolean handlesFile(IFile file)
- Specified by:
handlesFile
in interfaceITypeLoader
-
handlesDirectory
public boolean handlesDirectory(IDirectory dir)
- Specified by:
handlesDirectory
in interfaceITypeLoader
-
getNamespaceForDirectory
public String getNamespaceForDirectory(IDirectory dir)
- Specified by:
getNamespaceForDirectory
in interfaceITypeLoader
-
getTypesForFile
public String[] getTypesForFile(IFile file)
Description copied from interface:ITypeLoader
Returns 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:
getTypesForFile
in 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:ITypeLoader
Notifies 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:
refreshedFile
in 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: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 implementationThe name of a resource is a '/'-separated path name that identifies the resource.
- Specified by:
getResource
in 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:ITypeLoader
Fired when an existing type is refreshed, i.e. there are potential changes- Specified by:
refreshedTypes
in interfaceITypeLoader
-
refreshedTypesImpl
protected void refreshedTypesImpl(RefreshRequest request)
-
refreshed
public final void refreshed()
Description copied from interface:ITypeLoader
Fired when the typesystem is fully refreshed- Specified by:
refreshed
in interfaceITypeLoader
-
clearTypeNames
protected void clearTypeNames()
-
refreshedImpl
protected void refreshedImpl()
-
getTypeNames
public Set<TypeName> getTypeNames(String namespace)
- Specified by:
getTypeNames
in interfaceITypeLoader
-
getTypeNames
public static Set<TypeName> getTypeNames(String parentNamespace, ITypeLoader loader)
-
showTypeNamesInIDE
public boolean showTypeNamesInIDE()
- Specified by:
showTypeNamesInIDE
in interfaceITypeLoader
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfaceITypeLoader
-
deleteIndexFile
protected void deleteIndexFile()
-
saveTypeNames
public void saveTypeNames()
-
getAllTypeNames
public final Set<String> getAllTypeNames()
- Specified by:
getAllTypeNames
in 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()
-
-