Class ObjectFactory

java.lang.Object
org.mybatis.generator.internal.ObjectFactory

public class ObjectFactory extends Object
This class creates the different objects needed by the generator.
Author:
Jeff Butler
  • 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

      public static void addExternalClassLoader(ClassLoader classLoader)
      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

      public static Class<?> externalClassForName(String type) throws ClassNotFoundException
      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

      public static Object createExternalObject(String type)
    • internalClassForName

      public static Class<?> internalClassForName(String type) throws ClassNotFoundException
      Throws:
      ClassNotFoundException
    • getResource

      public static URL getResource(String resource)
    • createInternalObject

      public static Object createInternalObject(String type)
    • createJavaTypeResolver

      public static JavaTypeResolver createJavaTypeResolver(Context context, List<String> warnings)
    • createPlugin

      public static Plugin createPlugin(Context context, PluginConfiguration pluginConfiguration)
    • createCommentGenerator

      public static CommentGenerator createCommentGenerator(Context context)
    • createConnectionFactory

      public static ConnectionFactory createConnectionFactory(Context context)
    • createJavaFormatter

      public static JavaFormatter createJavaFormatter(Context context)
    • createKotlinFormatter

      public static KotlinFormatter createKotlinFormatter(Context context)
    • createXmlFormatter

      public static XmlFormatter createXmlFormatter(Context context)
    • createIntrospectedTable

      public static IntrospectedTable createIntrospectedTable(TableConfiguration tableConfiguration, FullyQualifiedTable table, Context context)
    • createIntrospectedTableForValidation

      public static IntrospectedTable createIntrospectedTableForValidation(Context context)
      Creates an introspected table implementation that is only usable for validation .
      Parameters:
      context - the context
      Returns:
      the introspected table
    • createIntrospectedColumn

      public static IntrospectedColumn createIntrospectedColumn(Context context)