public class PackageObjectFactory extends Object implements ModuleFactory
Modifier and Type | Class and Description |
---|---|
static class |
PackageObjectFactory.ModuleLoadOption
Enum class to define loading options.
|
Modifier and Type | Field and Description |
---|---|
static String |
AMBIGUOUS_MODULE_NAME_EXCEPTION_MESSAGE
Exception message when there is ambiguous module name in config file.
|
static String |
BASE_PACKAGE
Base package of checkstyle modules checks.
|
static String |
CHECK_SUFFIX
Suffix of checks.
|
static String |
NULL_LOADER_MESSAGE
Exception message when null class loader is given.
|
static String |
NULL_PACKAGE_MESSAGE
Exception message when null package name is given.
|
static String |
PACKAGE_SEPARATOR
Character separate package names in qualified name of java class.
|
static String |
STRING_SEPARATOR
Separator to use in strings.
|
static String |
UNABLE_TO_INSTANTIATE_EXCEPTION_MESSAGE
Exception message when it is unable to create a class instance.
|
Constructor and Description |
---|
PackageObjectFactory(Set<String> packageNames,
ClassLoader moduleClassLoader)
Creates a new
PackageObjectFactory instance. |
PackageObjectFactory(Set<String> packageNames,
ClassLoader moduleClassLoader,
PackageObjectFactory.ModuleLoadOption moduleLoadOption)
Creates a new
PackageObjectFactory instance. |
PackageObjectFactory(String packageName,
ClassLoader moduleClassLoader)
Creates a new
PackageObjectFactory instance. |
Modifier and Type | Method and Description |
---|---|
Object |
createModule(String name)
Creates a new instance of a class from a given name, or that name
concatenated with "Check".
|
public static final String BASE_PACKAGE
public static final String UNABLE_TO_INSTANTIATE_EXCEPTION_MESSAGE
public static final String AMBIGUOUS_MODULE_NAME_EXCEPTION_MESSAGE
public static final String CHECK_SUFFIX
public static final String PACKAGE_SEPARATOR
public static final String NULL_LOADER_MESSAGE
public static final String NULL_PACKAGE_MESSAGE
public static final String STRING_SEPARATOR
public PackageObjectFactory(Set<String> packageNames, ClassLoader moduleClassLoader)
PackageObjectFactory
instance.packageNames
- the list of package names to usemoduleClassLoader
- class loader used to load Checkstyle
core and custom modulespublic PackageObjectFactory(Set<String> packageNames, ClassLoader moduleClassLoader, PackageObjectFactory.ModuleLoadOption moduleLoadOption)
PackageObjectFactory
instance.packageNames
- the list of package names to usemoduleClassLoader
- class loader used to load Checkstyle
core and custom modulesmoduleLoadOption
- loading optionpublic PackageObjectFactory(String packageName, ClassLoader moduleClassLoader)
PackageObjectFactory
instance.packageName
- The package name to usemoduleClassLoader
- class loader used to load Checkstyle
core and custom modulespublic Object createModule(String name) throws CheckstyleException
createModule
in interface ModuleFactory
name
- the name of a class.Object
created by loader.CheckstyleException
- if an error occurs.Copyright © 2001–2018. All rights reserved.