Class ClassLoaderHandler<T>
java.lang.Object
ca.phon.util.resources.URLHandler<T>
ca.phon.util.resources.ClassLoaderHandler<T>
- All Implemented Interfaces:
ResourceHandler<T>,Iterable<T>
- Direct Known Subclasses:
DefaultDictionaryProvider,JsonSyllabifierProvider,OpGraphSyllabifierClassLoaderProvider,StockAnalysisHandler,StockMacroHandler,StockReportHandler,SystemQueryScriptHandler,TransliterationDictionaryProvider
Loads resources from a specified class loader (or the
default class loader if not specified.)
Resources are located using
ClassLoader.getResources(String)
for each specified resource.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructorConstructor -
Method Summary
Modifier and TypeMethodDescriptionvoidaddResource(String res) Add a resource to locateGet the class loader used by this handler.iterator()Return an iterator for instances of type T.voidloadResourceFile(String resFile) Load resource list from the give resource file.voidremoveResource(String res) Remove resourcevoidSet the class loader used by this handler.Methods inherited from class ca.phon.util.resources.URLHandler
add, getURLS, loadFromURL, removeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
resourcePaths
-
-
Constructor Details
-
ClassLoaderHandler
public ClassLoaderHandler()Constructor -
ClassLoaderHandler
-
-
Method Details
-
addResource
Add a resource to locate- Parameters:
res- the resource to locate. Use the naming rules outline byClassLoader.getResource(String).
-
loadResourceFile
Load resource list from the give resource file.- Parameters:
resFile-
-
removeResource
-
getResourcePaths
-
iterator
Description copied from interface:ResourceHandlerReturn an iterator for instances of type T.- Specified by:
iteratorin interfaceIterable<T>- Specified by:
iteratorin interfaceResourceHandler<T>- Overrides:
iteratorin classURLHandler<T>- Returns:
- an iterator providing instances of the parameterized type
-
getClassLoader
-
setClassLoader
Set the class loader used by this handler.- Parameters:
cl- the new class loader to use, ifnullthe default system classloader is used
-