Package gw.internal.gosu.properties
Class PropertiesTypeLoader
- java.lang.Object
-
- gw.config.BaseService
-
- gw.lang.reflect.TypeLoaderBase
-
- gw.internal.gosu.properties.PropertiesTypeLoader
-
- All Implemented Interfaces:
IService,ITypeLoader,IPluginHost
public class PropertiesTypeLoader extends TypeLoaderBase
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classPropertiesTypeLoader.TypeNameSetSet of case insensitive type names with operation to quickly find which type names in the set are possible matches for a full type name.
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set<java.lang.String>_namespacesprivate LockingLazyVar<java.util.Map<PropertySetSource,PropertiesTypeLoader.TypeNameSet>>_rootTypeNamesprivate java.util.List<PropertySetSource>_sourcesprivate static java.lang.StringDISPLAY_PROPERTIESprivate static java.lang.StringFILE_EXTENSION-
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 PropertiesTypeLoader(IModule module)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<java.lang.String>computeTypeNames()private java.util.Map<java.lang.String,IType>createPropertyTypesForPropertySetWithName(PropertySetSource source, java.lang.String name)private ITypecreatePropertyTypesFromPropertyNodeTree(java.util.HashMap<java.lang.String,IType> resultMap, PropertyNode node, IFile file)java.util.Set<java.lang.String>getAllNamespaces()Don't call this method unless you really know what you're doing.java.util.List<java.lang.String>getHandledPrefixes()<T> TgetInterface(java.lang.Class<T> apiInterface)Provides an implementation of a specified interface.ITypegetType(java.lang.String fullyQualifiedName)Gets a type based on a fully-qualified name.java.lang.String[]getTypesForFile(IFile file)Returns ALL type names associated with the given file whether or not the types have been loaded yet.booleanhandlesFile(IFile file)booleanhandlesNonPrefixLoads()booleanhasNamespace(java.lang.String namespace)private voidinitSources(IModule module)static booleanisDisplayPropertiesFile(java.lang.String fileName)RefreshKindrefreshedFile(IFile file, java.lang.String[] types, RefreshKind kind)Notifies the type loader that a file has been refreshed.voidrefreshedImpl()voidrefreshedNamespace(java.lang.String namespace, IDirectory dir, RefreshKind kind)-
Methods inherited from class gw.lang.reflect.TypeLoaderBase
clearTypeNames, deleteIndexFile, getAllTypeNames, getModule, getNamespaceForDirectory, getResource, getTypeNames, getTypeNames, handlesDirectory, isCaseSensitive, loadTypeNames, refreshed, refreshedTypes, refreshedTypesImpl, saveTypeNames, shouldCacheTypeNames, showTypeNamesInIDE, shutdown, toString
-
-
-
-
Field Detail
-
FILE_EXTENSION
private static final java.lang.String FILE_EXTENSION
- See Also:
- Constant Field Values
-
DISPLAY_PROPERTIES
private static final java.lang.String DISPLAY_PROPERTIES
- See Also:
- Constant Field Values
-
_namespaces
protected java.util.Set<java.lang.String> _namespaces
-
_sources
private java.util.List<PropertySetSource> _sources
-
_rootTypeNames
private final LockingLazyVar<java.util.Map<PropertySetSource,PropertiesTypeLoader.TypeNameSet>> _rootTypeNames
-
-
Constructor Detail
-
PropertiesTypeLoader
public PropertiesTypeLoader(IModule module)
-
-
Method Detail
-
initSources
private void initSources(IModule module)
-
computeTypeNames
public java.util.Set<java.lang.String> computeTypeNames()
-
getHandledPrefixes
public java.util.List<java.lang.String> getHandledPrefixes()
-
handlesNonPrefixLoads
public boolean handlesNonPrefixLoads()
-
handlesFile
public boolean handlesFile(IFile file)
- Specified by:
handlesFilein interfaceITypeLoader- Overrides:
handlesFilein classTypeLoaderBase
-
isDisplayPropertiesFile
public static boolean isDisplayPropertiesFile(java.lang.String fileName)
-
getType
public IType getType(java.lang.String fullyQualifiedName)
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:
fullyQualifiedName- the fully qualified name of the type- Returns:
- the corresponding IType or null
-
refreshedImpl
public void refreshedImpl()
- Overrides:
refreshedImplin classTypeLoaderBase
-
createPropertyTypesForPropertySetWithName
private java.util.Map<java.lang.String,IType> createPropertyTypesForPropertySetWithName(PropertySetSource source, java.lang.String name)
-
createPropertyTypesFromPropertyNodeTree
private IType createPropertyTypesFromPropertyNodeTree(java.util.HashMap<java.lang.String,IType> resultMap, PropertyNode node, IFile file)
-
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- Overrides:
getTypesForFilein classTypeLoaderBase- 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- Overrides:
refreshedFilein classTypeLoaderBase- Parameters:
file- The file that was refreshed- Returns:
- All known types affected by the file change
-
hasNamespace
public boolean hasNamespace(java.lang.String namespace)
-
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)
-
getInterface
public <T> T getInterface(java.lang.Class<T> apiInterface)
Description copied from interface:IPluginHostProvides an implementation of a specified interface.- Returns:
- The implementation of the interface or null if unsupported.
-
-