/*
 * Copyright (c) 2004-2017, by Alex Leigh.
 * All rights reserved.
 *
 * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE
 * The copyright notice above does not evidence any
 * actual or intended publication of such source code.
 */

package lc.mecha.pool;


/**
 * Classes implementing <code>Factory</code> provide a rich implementation of the classic factory pattern.
 *
 * @param <T> The class to factory.
 * @author Alex Leigh
 */
public interface Factory<T> {
    T create() throws Exception;

    void destroy(T obj);

    boolean validate(T obj);

    /**
     * Return the object to a pristine state, removing any user-defined settings and returning all values to default.
     * After <code>reset()</code>, the object is identical to one just instanced via <code>create()</code>.
     *
     * @param obj
     */
    void reset(T obj) throws Exception;
}
