xref: /OpenGrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/ObjectFactory.java (revision d1e826faf91bd41ab1a6d05ec6a5e19cb9865010)
1 /*
2  * The contents of this file are Copyright (c) 2012, Swaranga Sarma, DZone MVB
3  * made available under free license,
4  * http://javawithswaranga.blogspot.com/2011/10/generic-and-concurrent-object-pool.html
5  * https://dzone.com/articles/generic-and-concurrent-object : "Feel free to use
6  * it, change it, add more implementations. Happy coding!"
7  * Copyright (c) 2017, Chris Fraire <cfraire@me.com>.
8  */
9 
10 package org.opengrok.indexer.util;
11 
12 /**
13  * Represents an API for the mechanism to create
14  * new objects to be used in an object pool.
15  * @author Swaranga
16  * @param <T> the type of object to create.
17  */
18 public interface ObjectFactory<T> {
19 
20     /**
21      * Returns a new instance of an object of type T.
22      * @return T an new instance of the object of type T
23      */
createNew()24     T createNew();
25 }
26