Interface ObjectFactory

All Known Implementing Classes:
DefaultObjectFactory

public interface ObjectFactory
MyBatis uses an ObjectFactory to create all needed new Objects.
Author:
Clinton Begin
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    create(Class<T> type)
    Creates a new object with default constructor.
    <T> T
    create(Class<T> type, List<Class<?>> constructorArgTypes, List<Object> constructorArgs)
    Creates a new object with the specified constructor and params.
    <T> boolean
    Returns true if this object can have a set of other objects.
    default void
    Sets configuration properties.
  • Method Details

    • setProperties

      default void setProperties(Properties properties)
      Sets configuration properties.
      Parameters:
      properties - configuration properties
    • create

      <T> T create(Class<T> type)
      Creates a new object with default constructor.
      Type Parameters:
      T - the generic type
      Parameters:
      type - Object type
      Returns:
      the t
    • create

      <T> T create(Class<T> type, List<Class<?>> constructorArgTypes, List<Object> constructorArgs)
      Creates a new object with the specified constructor and params.
      Type Parameters:
      T - the generic type
      Parameters:
      type - Object type
      constructorArgTypes - Constructor argument types
      constructorArgs - Constructor argument values
      Returns:
      the t
    • isCollection

      <T> boolean isCollection(Class<T> type)
      Returns true if this object can have a set of other objects. It's main purpose is to support non-java.util.Collection objects like Scala collections.
      Type Parameters:
      T - the generic type
      Parameters:
      type - Object type
      Returns:
      whether it is a collection or not
      Since:
      3.1.0