1 package net.sourceforge.jparam.conversion.creators;
2
3 import net.sourceforge.jparam.JParamException;
4
5 /***
6 * This interface represents a creator object, creator object can create a
7 * specific objects given a specific set of parameters
8 *
9 * @author Ron_Sidi
10 *
11 */
12 public interface ICreator {
13 /***
14 * Return the <code>Class</code> of the expected object that this creator
15 * can create
16 *
17 * @return A <code>Class</code> the created object will be instanceof
18 */
19 Class getReturnClass();
20
21 /***
22 * Returns the type of parameters that this creator expects to recieve
23 * <p>
24 * If the parameters given to the create method do not conform to these
25 * an exception will be thrown
26 *
27 * @return A <code>Class[]</code> representing the expected parameter types
28 */
29 Class[] getParameterTypes();
30
31 /***
32 * Returns an object of type <code>getReturnClass</code> using the given
33 * parameters as input
34 *
35 * @param parameters An array of object whose types should conform with
36 * <code>getParameterTypes</code>
37 * @return Object created with the parameters
38 * @throws JParamException if there was an error during construction of the
39 * object, or if the parameters do not conform to the requierment
40 */
41 Object create(Object[] parameters) throws JParamException;
42
43 /***
44 * Tests if the given argument index can be null, if the argument type is a
45 * primitive one, it should be converted to its wrapper class, but it will
46 * not support null as a value
47 *
48 * @param index The index of the argument to be tested
49 * @return false if the argument represents a primitive type false otherwise
50 */
51 boolean canBeNull(int index);
52 }