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 voidaddExternalClassLoader(ClassLoader classLoader) Adds a custom classloader to the collection of classloaders searched for "external" classes.static CommentGeneratorcreateCommentGenerator(Context context) static ConnectionFactorycreateConnectionFactory(Context context) static ObjectcreateExternalObject(String type) static ObjectcreateInternalObject(String type) static IntrospectedColumncreateIntrospectedColumn(Context context) static IntrospectedTablecreateIntrospectedTable(TableConfiguration tableConfiguration, FullyQualifiedTable table, Context context) static IntrospectedTableCreates an introspected table implementation that is only usable for validation .static JavaFormattercreateJavaFormatter(Context context) static JavaTypeResolvercreateJavaTypeResolver(Context context, List<String> warnings) static KotlinFormattercreateKotlinFormatter(Context context) static PlugincreatePlugin(Context context, PluginConfiguration pluginConfiguration) static XmlFormattercreateXmlFormatter(Context context) static Class<?> externalClassForName(String type) Returns a class loaded from the context classloader, or the classloader supplied by a client.static URLgetResource(String resource) static Class<?> internalClassForName(String type) static voidreset()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
-