Class DefaultObjectFactory

  • All Implemented Interfaces:
    java.io.Serializable, ObjectFactory

    public class DefaultObjectFactory
    extends java.lang.Object
    implements ObjectFactory, java.io.Serializable
    Author:
    Clinton Begin
    See Also:
    Serialized Form
    • 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.
      protected java.lang.Class<?> resolveInterface​(java.lang.Class<?> type)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultObjectFactory

        public DefaultObjectFactory()
    • Method Detail

      • create

        public <T> T create​(java.lang.Class<T> type)
        Description copied from interface: ObjectFactory
        Creates a new object with default constructor.
        Specified by:
        create in interface ObjectFactory
        Parameters:
        type - Object type
        Returns:
      • create

        public <T> T create​(java.lang.Class<T> type,
                            java.util.List<java.lang.Class<?>> constructorArgTypes,
                            java.util.List<java.lang.Object> constructorArgs)
        Description copied from interface: ObjectFactory
        Creates a new object with the specified constructor and params.
        Specified by:
        create in interface ObjectFactory
        Parameters:
        type - Object type
        constructorArgTypes - Constructor argument types
        constructorArgs - Constructor argument values
        Returns:
      • resolveInterface

        protected java.lang.Class<?> resolveInterface​(java.lang.Class<?> type)
      • isCollection

        public <T> boolean isCollection​(java.lang.Class<T> type)
        Description copied from interface: ObjectFactory
        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.
        Specified by:
        isCollection in interface ObjectFactory
        Parameters:
        type - Object type
        Returns:
        whether it is a collection or not