public class ClassPathUtils extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
ClassPathUtils.IURLResolver
Interface for performing URL resolving.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_FILE_SUFFIX
Suffix for class files.
|
Constructor and Description |
---|
ClassPathUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
createClassPath(ClassPathUtils.IURLResolver resolver,
java.lang.Class<?> anchorClass)
Create class path for an anchor class.
|
static java.lang.String[] |
createClassPathAsArray(ClassPathUtils.IURLResolver resolver,
java.lang.Class<?>... anchorClasses)
This method calls
createClassPath(IURLResolver, Class) for each
class and returns the classpath as String array. |
static java.util.LinkedHashSet<java.lang.String> |
createClassPathAsSet(ClassPathUtils.IURLResolver resolver,
java.lang.Class<?>... anchorClasses)
This method calls
createClassPath(IURLResolver, Class) for each
class and returns the classpath as ordered set. |
static java.lang.String |
createClassPathAsString(ClassPathUtils.IURLResolver resolver,
java.lang.Class<?>... anchorClasses)
This method calls
createClassPath(IURLResolver, Class) for each
class and concatenates them with File.pathSeparator . |
static java.util.List<java.lang.String> |
getClassNames(java.io.File directory)
Returns the fully qualified name of all java classes within the given
directory and subdirectories.
|
static java.net.URL |
obtainClassFileURL(java.lang.Class<?> clazz)
Returns the URL for the .class-file of a given class.
|
public static final java.lang.String CLASS_FILE_SUFFIX
public ClassPathUtils()
public static java.lang.String createClassPathAsString(ClassPathUtils.IURLResolver resolver, java.lang.Class<?>... anchorClasses) throws java.io.IOException
createClassPath(IURLResolver, Class)
for each
class and concatenates them with File.pathSeparator
.java.io.IOException
public static java.lang.String[] createClassPathAsArray(ClassPathUtils.IURLResolver resolver, java.lang.Class<?>... anchorClasses) throws java.io.IOException
createClassPath(IURLResolver, Class)
for each
class and returns the classpath as String array.java.io.IOException
public static java.util.LinkedHashSet<java.lang.String> createClassPathAsSet(ClassPathUtils.IURLResolver resolver, java.lang.Class<?>... anchorClasses) throws java.io.IOException
createClassPath(IURLResolver, Class)
for each
class and returns the classpath as ordered set.resolver
- an optional resolver (may be null) that can be used to map
special URLs (for example in the Eclipse context).java.io.IOException
public static java.lang.String createClassPath(ClassPathUtils.IURLResolver resolver, java.lang.Class<?> anchorClass) throws java.io.IOException
resolver
- an optional resolver (may be null) that can be used to map
special URLs (for example in the Eclipse context).java.io.IOException
public static java.net.URL obtainClassFileURL(java.lang.Class<?> clazz)
public static java.util.List<java.lang.String> getClassNames(java.io.File directory)