@Component @Scope public class ScanUtils extends Object implements org.springframework.context.ApplicationContextAware
| 构造器和说明 |
|---|
ScanUtils()
Constructor.Set the class loader.
|
| 限定符和类型 | 方法和说明 |
|---|---|
String[] |
getLoadedPackages()
Get the package name loaded.
|
protected void |
loadClassPackage(URL url)
Load the package
|
Map<String,Object> |
scan(File directoryOrFile)
Scan all the classes in the directory or jar package.
|
protected Map<String,Object> |
scan(File directoryOrFile,
Map<String,Object> result)
Scan all the classes in the directory or jar package.
|
protected Map<String,Object> |
scanAClassFile(File classFile,
Map<String,Object> result)
Scan a class.
|
protected Map<String,Object> |
scanJarPackage(File file,
Map<String,Object> result)
Scan a jar package.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
Spring injection.
|
public ScanUtils()
throws NoSuchMethodException
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext 在接口中 org.springframework.context.ApplicationContextAwareapplicationContext - the application contextorg.springframework.beans.BeansException - the exceptionpublic Map<String,Object> scan(File directoryOrFile) throws ClassNotFoundException, InvocationTargetException, IllegalAccessException, IOException
directoryOrFile - the directory,the class file or jar file.ClassNotFoundExceptionInvocationTargetExceptionIllegalAccessExceptionIOExceptionpublic String[] getLoadedPackages()
protected Map<String,Object> scan(File directoryOrFile, Map<String,Object> result) throws ClassNotFoundException, IOException, IllegalAccessException, InvocationTargetException
directoryOrFile - the directory,the class file or jar file.ClassNotFoundExceptionIOExceptionIllegalAccessExceptionInvocationTargetExceptionprotected Map<String,Object> scanJarPackage(File file, Map<String,Object> result) throws IOException, InvocationTargetException, IllegalAccessException, ClassNotFoundException
file - the jar package file.IOExceptionInvocationTargetExceptionIllegalAccessExceptionClassNotFoundExceptionprotected Map<String,Object> scanAClassFile(File classFile, Map<String,Object> result) throws MalformedURLException, InvocationTargetException, IllegalAccessException, ClassNotFoundException
classFile - the class file.MalformedURLExceptionInvocationTargetExceptionIllegalAccessExceptionClassNotFoundExceptionprotected void loadClassPackage(URL url) throws InvocationTargetException, IllegalAccessException
url - the file urlInvocationTargetExceptionIllegalAccessExceptionCopyright © 2018. All rights reserved.