1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.collections15.functors.factory;
17
18 import net.sf.collections15.Factory;
19 import net.sf.collections15.functors.FunctorException;
20
21 import java.io.Serializable;
22
23
24 /***
25 * <code>Factory</code> implementation that always throws an exception.
26 *
27 * @author Stephen Colebourne
28 * @author Chris Lambrou (port to Java 5.0)
29 * @since Collections15 1.0
30 */
31 public final class ExceptionFactory <E> implements Factory<E>, Serializable
32 {
33
34 static final long serialVersionUID = 9220282047327793665L;
35
36 /***
37 * Returns an <code>ExceptionFactory</code> instance.
38 *
39 * @return An <code>ExceptionFactory</code> instance.
40 *
41 * @since Collections15 1.0
42 */
43 public static <T> ExceptionFactory<T> getInstance()
44 {
45 return new ExceptionFactory<T>();
46 }
47
48 /***
49 * Creates a new instance.
50 */
51 protected ExceptionFactory()
52 {
53 }
54
55 /***
56 * Always throws an exception.
57 *
58 * @return This method never returns. It always throws an exception.
59 *
60 * @throws FunctorException Thrown when the method is invoked.
61 */
62 public E create() throws FunctorException
63 {
64 throw new FunctorException("ExceptionFactory invoked");
65 }
66
67 }