Package com.evolveum.midpoint.util
Class ClassPathUtil
- java.lang.Object
-
- com.evolveum.midpoint.util.ClassPathUtil
-
public class ClassPathUtil extends Object
Various class path, class loading and class scanning utilities. For more info about class-path scanning: https://github.com/classgraph/classgraph
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_PACKAGE_TO_SCAN
static Trace
LOGGER
-
Constructor Summary
Constructors Constructor Description ClassPathUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
copyFile(InputStream srcStream, String srcName, File dstFile)
static boolean
copyFile(InputStream srcStream, String srcName, OutputStream dstStream, String dstName)
static boolean
copyFile(InputStream srcStream, String srcName, String dstPath)
static boolean
extractFileFromClassPath(String src, String dst)
Extract specified source on class path to file system dststatic boolean
extractFilesFromClassPath(String srcPath, String dstPath, boolean overwrite)
Extracts all files in a directory on a classPath (system resource) to a directory on a file system.static Set<Class<?>>
listClasses(Package pkg)
static Set<Class<?>>
listClasses(String... packageNames)
static Collection<Class<?>>
scanClasses(Class<? extends Annotation> annotationClass, String packageNames)
static Collection<Class<?>>
scanClasses(Class<? extends Annotation> annotationClass, String... packageNames)
-
-
-
Field Detail
-
LOGGER
public static final Trace LOGGER
-
DEFAULT_PACKAGE_TO_SCAN
public static final String DEFAULT_PACKAGE_TO_SCAN
- See Also:
- Constant Field Values
-
-
Method Detail
-
scanClasses
public static Collection<Class<?>> scanClasses(Class<? extends Annotation> annotationClass, String packageNames)
- Parameters:
annotationClass
-packageNames
- comma separated package names- Returns:
-
scanClasses
public static Collection<Class<?>> scanClasses(Class<? extends Annotation> annotationClass, String... packageNames)
-
extractFileFromClassPath
public static boolean extractFileFromClassPath(String src, String dst)
Extract specified source on class path to file system dst- Parameters:
src
- sourcedst
- destination- Returns:
- successful extraction
-
copyFile
public static boolean copyFile(InputStream srcStream, String srcName, String dstPath)
-
copyFile
public static boolean copyFile(InputStream srcStream, String srcName, File dstFile)
-
copyFile
public static boolean copyFile(InputStream srcStream, String srcName, OutputStream dstStream, String dstName)
-
extractFilesFromClassPath
public static boolean extractFilesFromClassPath(String srcPath, String dstPath, boolean overwrite) throws URISyntaxException, IOException
Extracts all files in a directory on a classPath (system resource) to a directory on a file system.- Throws:
URISyntaxException
IOException
-
-