Package gw.lang.reflect.gs
Class GosuClassTypeLoader
- java.lang.Object
-
- gw.config.BaseService
-
- gw.lang.reflect.TypeLoaderBase
-
- gw.lang.reflect.SimpleTypeLoader
-
- gw.lang.reflect.gs.GosuClassTypeLoader
-
- All Implemented Interfaces:
IService,ITypeLoader,IPluginHost
public class GosuClassTypeLoader extends SimpleTypeLoader
-
-
Field Summary
Fields Modifier and Type Field Description private LockingLazyVar<IEnhancementIndex>_enhancementIndexprotected java.util.Set<java.lang.String>_namespacesprivate IGosuClassRepository_repositorystatic java.lang.String[]ALL_EXTSstatic java.util.Set<java.lang.String>ALL_EXTS_SETstatic java.lang.StringBLOCK_POSTFIXstatic java.lang.StringBLOCK_PREFIXstatic java.util.Set<java.lang.String>EXTENSIONSstatic java.lang.StringGOSU_CLASS_FILE_EXTstatic java.lang.StringGOSU_ENHANCEMENT_FILE_EXTstatic java.lang.StringGOSU_PROGRAM_FILE_EXTstatic java.lang.StringGOSU_RULE_EXTstatic java.lang.StringGOSU_RULE_SET_EXTstatic java.lang.StringGOSU_TEMPLATE_FILE_EXTstatic java.lang.StringINNER_BLOCK_PREFIX-
Fields inherited from class gw.lang.reflect.TypeLoaderBase
_module, _typeNames
-
Fields inherited from interface gw.lang.reflect.ITypeLoader
NO_TYPES
-
-
Constructor Summary
Constructors Constructor Description GosuClassTypeLoader(IGosuClassRepository repository)GosuClassTypeLoader(IModule module, IGosuClassRepository repository)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<java.lang.String>computeTypeNames()private IGosuClassfindClass(java.lang.String strQualifiedClassName)private IGosuClassgetAdapterClass(java.lang.String strFullyQualifiedName)protected java.lang.String[]getAllExtensions()java.util.Set<java.lang.String>getAllNamespaces()Don't call this method unless you really know what you're doing.private IGosuClassgetBlockType(java.lang.String strName)static GosuClassTypeLoadergetDefaultClassLoader()static GosuClassTypeLoadergetDefaultClassLoader(IModule module)IEnhancementIndexgetEnhancementIndex()java.util.Set<java.lang.String>getExtensions()java.util.List<java.lang.String>getHandledPrefixes()IGosuClassRepositorygetRepository()java.net.URLgetResource(java.lang.String name)Finds the resource with the given name.ICompilableTypegetType(java.lang.String strFullyQualifiedName)Gets a type based on a fully-qualified name.java.util.Set<TypeName>getTypeNames(java.lang.String namespace)protected ITypeUsesMapgetTypeUsesMap()booleanhandlesNonPrefixLoads()booleanhasNamespace(java.lang.String namespace)private booleanisBlock(java.lang.String strName)booleanisCaseSensitive()protected booleanisValidSourceFileHandle(ISourceFileHandle sourceFile)private voidmakeEnhancementIndex()IGosuClassmakeNewClass(ISourceFileHandle sourceFile)IGosuClassmakeNewClass(ISourceFileHandle sourceFile, ISymbolTable programSymTable)voidrefreshedImpl()voidrefreshedNamespace(java.lang.String namespace, IDirectory dir, RefreshKind kind)voidrefreshedTypesImpl(RefreshRequest request)booleanshouldKeepDebugInfo(IGosuClass gsClass)-
Methods inherited from class gw.lang.reflect.SimpleTypeLoader
getNamespaceForDirectory, getTypesForFile, handlesDirectory, handlesFile, refreshedFile
-
Methods inherited from class gw.lang.reflect.TypeLoaderBase
clearTypeNames, deleteIndexFile, getAllTypeNames, getModule, getTypeNames, loadTypeNames, refreshed, refreshedTypes, saveTypeNames, shouldCacheTypeNames, showTypeNamesInIDE, shutdown, 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
-
-
-
-
Field Detail
-
GOSU_CLASS_FILE_EXT
public static final java.lang.String GOSU_CLASS_FILE_EXT
- See Also:
- Constant Field Values
-
GOSU_ENHANCEMENT_FILE_EXT
public static final java.lang.String GOSU_ENHANCEMENT_FILE_EXT
- See Also:
- Constant Field Values
-
GOSU_PROGRAM_FILE_EXT
public static final java.lang.String GOSU_PROGRAM_FILE_EXT
- See Also:
- Constant Field Values
-
GOSU_TEMPLATE_FILE_EXT
public static final java.lang.String GOSU_TEMPLATE_FILE_EXT
- See Also:
- Constant Field Values
-
GOSU_RULE_EXT
public static final java.lang.String GOSU_RULE_EXT
- See Also:
- Constant Field Values
-
GOSU_RULE_SET_EXT
public static final java.lang.String GOSU_RULE_SET_EXT
- See Also:
- Constant Field Values
-
ALL_EXTS
public static final java.lang.String[] ALL_EXTS
-
ALL_EXTS_SET
public static final java.util.Set<java.lang.String> ALL_EXTS_SET
-
EXTENSIONS
public static final java.util.Set<java.lang.String> EXTENSIONS
-
BLOCK_PREFIX
public static final java.lang.String BLOCK_PREFIX
- See Also:
- Constant Field Values
-
INNER_BLOCK_PREFIX
public static final java.lang.String INNER_BLOCK_PREFIX
- See Also:
- Constant Field Values
-
BLOCK_POSTFIX
public static final java.lang.String BLOCK_POSTFIX
- See Also:
- Constant Field Values
-
_repository
private IGosuClassRepository _repository
-
_enhancementIndex
private LockingLazyVar<IEnhancementIndex> _enhancementIndex
-
_namespaces
protected java.util.Set<java.lang.String> _namespaces
-
-
Constructor Detail
-
GosuClassTypeLoader
public GosuClassTypeLoader(IGosuClassRepository repository)
-
GosuClassTypeLoader
public GosuClassTypeLoader(IModule module, IGosuClassRepository repository)
-
-
Method Detail
-
getDefaultClassLoader
public static GosuClassTypeLoader getDefaultClassLoader()
-
getDefaultClassLoader
public static GosuClassTypeLoader getDefaultClassLoader(IModule module)
-
makeEnhancementIndex
private void makeEnhancementIndex()
-
getRepository
public IGosuClassRepository getRepository()
-
getEnhancementIndex
public IEnhancementIndex getEnhancementIndex()
-
isCaseSensitive
public boolean isCaseSensitive()
- Specified by:
isCaseSensitivein interfaceITypeLoader- Overrides:
isCaseSensitivein classTypeLoaderBase
-
getType
public ICompilableType getType(java.lang.String strFullyQualifiedName)
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.- Parameters:
strFullyQualifiedName- the fully qualified name of the type- Returns:
- the corresponding IType or null
-
getAdapterClass
private IGosuClass getAdapterClass(java.lang.String strFullyQualifiedName)
-
getAllNamespaces
public java.util.Set<java.lang.String> getAllNamespaces()
Description copied from interface:ITypeLoaderDon't call this method unless you really know what you're doing.- Returns:
- the set of package (aka namespace) names in which this loader's types reside.
-
refreshedNamespace
public void refreshedNamespace(java.lang.String namespace, IDirectory dir, RefreshKind kind)
-
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- 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.
-
computeTypeNames
public java.util.Set<java.lang.String> computeTypeNames()
-
refreshedImpl
public void refreshedImpl()
- Overrides:
refreshedImplin classTypeLoaderBase
-
getHandledPrefixes
public java.util.List<java.lang.String> getHandledPrefixes()
-
handlesNonPrefixLoads
public boolean handlesNonPrefixLoads()
-
makeNewClass
public IGosuClass makeNewClass(ISourceFileHandle sourceFile)
-
makeNewClass
public IGosuClass makeNewClass(ISourceFileHandle sourceFile, ISymbolTable programSymTable)
-
getBlockType
private IGosuClass getBlockType(java.lang.String strName)
-
isBlock
private boolean isBlock(java.lang.String strName)
-
findClass
private IGosuClass findClass(java.lang.String strQualifiedClassName)
-
isValidSourceFileHandle
protected boolean isValidSourceFileHandle(ISourceFileHandle sourceFile)
-
getAllExtensions
protected java.lang.String[] getAllExtensions()
-
getTypeUsesMap
protected ITypeUsesMap getTypeUsesMap()
-
refreshedTypesImpl
public void refreshedTypesImpl(RefreshRequest request)
- Overrides:
refreshedTypesImplin classTypeLoaderBase
-
shouldKeepDebugInfo
public boolean shouldKeepDebugInfo(IGosuClass gsClass)
-
getExtensions
public java.util.Set<java.lang.String> getExtensions()
- Specified by:
getExtensionsin classSimpleTypeLoader
-
getTypeNames
public java.util.Set<TypeName> getTypeNames(java.lang.String namespace)
- Specified by:
getTypeNamesin interfaceITypeLoader- Overrides:
getTypeNamesin classTypeLoaderBase
-
hasNamespace
public boolean hasNamespace(java.lang.String namespace)
-
-