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​(java.lang.Class<T> type)
      Creates a new object with default constructor.
      <T> T create​(java.lang.Class<T> type, java.util.List<java.lang.Class<?>> constructorArgTypes, java.util.List<java.lang.Object> constructorArgs)
      Creates a new object with the specified constructor and params.
      <T> boolean isCollection​(java.lang.Class<T> type)
      Returns true if this object can have a set of other objects.
      default void setProperties​(java.util.Properties properties)
      Sets configuration properties.
    • Method Detail

      • setProperties

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

        <T> T create​(java.lang.Class<T> type)
        Creates a new object with default constructor.
        Parameters:
        type - Object type
        Returns:
      • create

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

        <T> boolean isCollection​(java.lang.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.
        Parameters:
        type - Object type
        Returns:
        whether it is a collection or not
        Since:
        3.1.0