public abstract class MainClassFinder extends Object
public static main
method by performing a breadth first
search.Constructor and Description |
---|
MainClassFinder() |
Modifier and Type | Method and Description |
---|---|
static String |
findMainClass(File rootFolder)
Find the main class from a given folder.
|
static String |
findMainClass(JarFile jarFile,
String classesLocation)
Find the main class in a given jar file.
|
static String |
findSingleMainClass(Collection<File> rootFolders,
String annotationName)
Find a single main class from the given
rootFolders . |
static String |
findSingleMainClass(File rootFolder)
Find a single main class from the given
rootFolder . |
static String |
findSingleMainClass(File rootFolder,
String annotationName)
Find a single main class from the given
rootFolder . |
static String |
findSingleMainClass(JarFile jarFile,
String classesLocation)
Find a single main class in a given jar file.
|
static String |
findSingleMainClass(JarFile jarFile,
String classesLocation,
String annotationName)
Find a single main class in a given jar file.
|
public static String findMainClass(File rootFolder) throws IOException
rootFolder
- the root folder to searchnull
IOException
- if the folder cannot be readpublic static String findSingleMainClass(File rootFolder) throws IOException
rootFolder
.rootFolder
- the root folder to searchnull
IOException
- if the folder cannot be readpublic static String findSingleMainClass(File rootFolder, String annotationName) throws IOException
rootFolder
. A main class annotated
with an annotation with the given annotationName
will be preferred over a
main class with no such annotation.rootFolder
- the root folder to searchannotationName
- the name of the annotation that may be present on the main
classnull
IOException
- if the folder cannot be readpublic static String findSingleMainClass(Collection<File> rootFolders, String annotationName) throws IOException
rootFolders
. A main class annotated
with an annotation with the given annotationName
will be preferred over a
main class with no such annotation.rootFolders
- the root folders to searchannotationName
- the name of the annotation that may be present on the main
classnull
IOException
- if a root folder cannot be readpublic static String findMainClass(JarFile jarFile, String classesLocation) throws IOException
jarFile
- the jar file to searchclassesLocation
- the location within the jar containing classesnull
IOException
- if the jar file cannot be readpublic static String findSingleMainClass(JarFile jarFile, String classesLocation) throws IOException
jarFile
- the jar file to searchclassesLocation
- the location within the jar containing classesnull
IOException
- if the jar file cannot be readpublic static String findSingleMainClass(JarFile jarFile, String classesLocation, String annotationName) throws IOException
annotationName
will be preferred over a main
class with no such annotation.jarFile
- the jar file to searchclassesLocation
- the location within the jar containing classesannotationName
- the name of the annotation that may be present on the main
classnull
IOException
- if the jar file cannot be readCopyright © 2019 Pivotal Software, Inc.. All rights reserved.