Interface ObjectFactory

  • All Known Implementing Classes:
    ObjenesisObjectFactory

    public interface ObjectFactory
    Strategy interface for object creation.
    Since:
    4.0
    Author:
    Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com)
    • Method Detail

      • createInstance

        <T> T createInstance​(java.lang.Class<T> type,
                             RandomizerContext context)
                      throws ObjectCreationException
        Create a new instance of type in the given randomization context.
        Type Parameters:
        T - generic type
        Parameters:
        type - to create
        context - current randomization context
        Returns:
        new instance of the given type
        Throws:
        ObjectCreationException - when unable to create an instance of the given type