Package org.mybatis.generator.internal
Class ObjectFactory
java.lang.Object
org.mybatis.generator.internal.ObjectFactory
This class creates the different objects needed by the generator.
- Author:
- Jeff Butler
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addExternalClassLoader
(ClassLoader classLoader) Adds a custom classloader to the collection of classloaders searched for "external" classes.static CommentGenerator
createCommentGenerator
(Context context) static ConnectionFactory
createConnectionFactory
(Context context) static Object
createExternalObject
(String type) static Object
createInternalObject
(String type) static IntrospectedColumn
createIntrospectedColumn
(Context context) static IntrospectedTable
createIntrospectedTable
(TableConfiguration tableConfiguration, FullyQualifiedTable table, Context context) static IntrospectedTable
Creates an introspected table implementation that is only usable for validation .static JavaFormatter
createJavaFormatter
(Context context) static JavaTypeResolver
createJavaTypeResolver
(Context context, List<String> warnings) static KotlinFormatter
createKotlinFormatter
(Context context) static Plugin
createPlugin
(Context context, PluginConfiguration pluginConfiguration) static XmlFormatter
createXmlFormatter
(Context context) static Class
<?> externalClassForName
(String type) Returns a class loaded from the context classloader, or the classloader supplied by a client.static URL
getResource
(String resource) static Class
<?> internalClassForName
(String type) static void
reset()
Clears the class loaders.
-
Method Details
-
reset
public static void reset()Clears the class loaders. This method should be called at the beginning of a generation run so that and change to the classloading configuration will be reflected. For example, if the eclipse launcher changes configuration it might not be updated if eclipse hasn't been restarted. -
addExternalClassLoader
Adds a custom classloader to the collection of classloaders searched for "external" classes. These are classes that do not depend on any of the generator's classes or interfaces. Examples are JDBC drivers, root classes, root interfaces, etc.- Parameters:
classLoader
- the class loader
-
externalClassForName
Returns a class loaded from the context classloader, or the classloader supplied by a client. This is appropriate for JDBC drivers, model root classes, etc. It is not appropriate for any class that extends one of the supplied classes or interfaces.- Parameters:
type
- the type- Returns:
- the Class loaded from the external classloader
- Throws:
ClassNotFoundException
- the class not found exception
-
createExternalObject
-
internalClassForName
- Throws:
ClassNotFoundException
-
getResource
-
createInternalObject
-
createJavaTypeResolver
-
createPlugin
-
createCommentGenerator
-
createConnectionFactory
-
createJavaFormatter
-
createKotlinFormatter
-
createXmlFormatter
-
createIntrospectedTable
public static IntrospectedTable createIntrospectedTable(TableConfiguration tableConfiguration, FullyQualifiedTable table, Context context) -
createIntrospectedTableForValidation
Creates an introspected table implementation that is only usable for validation .- Parameters:
context
- the context- Returns:
- the introspected table
-
createIntrospectedColumn
-